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
>> 
>> 
> 

Reply via email to