I've finally had a chance to take a good look at this. This looks fine
for the use case it covers, that is, properties of objects which observe
some kind of event listener design (don't know the details). What about
properties of properties of objects---like ${obj.prop.subprop}? If the
"obj.prop" value changes, do the binding listeners get notified?
Cheers,
Michael
On Wed, 14 Jul 2010, Greg Brown wrote:
I moved it to the tutorials project:
http://svn.apache.org/repos/asf/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/databinding/property_binding.bxml
http://svn.apache.org/repos/asf/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/databinding/PropertyBinding.java
On Jul 14, 2010, at 12:04 AM, Michael Allman wrote:
Greg,
I get a 404 when I go to the source code URL. Can you check it please?
Michael
On Fri, 9 Jul 2010, Greg Brown wrote:
Hi all,
This feature is now complete. BXMLSerializer now supports dynamic namespace
binding via the syntax I suggested in my earlier email. You can see a demo here:
http://ixnay.biz/pivot-demos/namespace-binding.html
The source code is here:
http://svn.apache.org/repos/asf/pivot/trunk/demos/src/org/apache/pivot/demos/binding/
I'm pretty happy with how it turned out. Let me know what you think.
G
On Jul 8, 2010, at 10:40 AM, Greg Brown wrote:
FYI, I have just checked in initial support for this feature. I haven't hooked
it in to BXMLSerializer yet, but you can see it in action here:
http://svn.apache.org/repos/asf/pivot/trunk/demos/src/org/apache/pivot/demos/binding/
On Jul 5, 2010, at 3:45 PM, Greg Brown wrote:
Another question that seems to come up fairly often is - "does Pivot support dynamic data
binding like Flex?" Historically, the answer we have given is, "no, Pivot's data binding
support is based on a load/store model that maps well to client/server applications such as REST
clients."
However, there are cases where Flex-like data binding can be useful. Given the
recent updates to BXMLSerializer, I think it may now be relatively
straightforward to implement. It may also be a good way to support dynamically
updatable styles, since style values are simply page variables, just like
everything else. Consider the following example:
<Label text="$text">
<styles color="$styles.color"/>
</Label>
When loaded, the text property of the label will be set to the value of the "text"
variable, and the color style will be set to the value of the "styles.color" variable. It
may be possible to (fairly easily) extend the syntax of BXML such that something like the following
would cause the text property and color style to automatically reflect changes to the source
variable:
<Label text="${text}">
<styles color="${styles.color}"/>
</Label>
Basically, this syntax (or something like it) would be a cue to the serializer
to register a change listener on the given variable and propagate any changes
to the bound property.
I haven't prototyped it, so I'm not sure what hidden gotchas we might run into, but I think it could work.
The primary trick will be in determining the type of the parent object and registering an appropriate
listener. For example, if "styles" in the above example is a Map, we would register a MapListener
on the "styles" object to be notified of changes to the "color" variable. If it is a
bean, we'd need to use something like the BeanMonitor class used in the Component Explorer demo. That means
we'd probably want to move that class to org.apache.pivot.beans (which might be worth doing anyways).
Let me know what you think. If there is sufficient interest, I may try to get
it working.
G