pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Karel Hübl <karel.h...@gemsystem.cz>
Subject MVC - Binding POJO model classes to Pivot View
Date Mon, 10 Dec 2012 07:26:52 GMT
Hi,

I did not find any tutorial describing how to bind model classes (POJO) to
Pivot view components (BXML). I used to do this in Flex by anotating
ActionScript model classes with @Bindable.

 

When I tried property binding in Pivot with my POJO model class, a I was
getting  java.lang.IllegalArgumentException: "xxx" is not a notifying
property.

I looked the PIVOT source codes (NamespaceBinding, BeanAdapter and
BeanProxy) and I realized that my model class has to implement getXXX
ListenerList<MyModelChangeListener> method.

 

So this is working for me (I can bind data from MyModel to tableData
property of Pivot TableView and upgrades of data in MyModel are propagated
into Pivot table):

 

public class MyModel {

                

                private ArrayList<MyVO> data = new ArrayList<MyVO>();

                

                public MyModel() {

                }

 

                public ArrayList<MyVO> getData() {

                               return data;

                }

 

                public void setData(ArrayList<MyVO> data) {

                               this.data = data;

                               listenerList.dataChanged(this);

                               

                }

                

                private MyModelListenerList listenerList=new
MyModelListenerList();

                

                public ListenerList<MyModelListener> getListenerList() {

                               return listenerList;

                }

                

                /**

                * Model listener interface.

                * */

                public interface MyModelListener {

                               public void dataChanged(Object bean);

                }

 

                private class MyModelListenerList extends
ListenerList<MyModelListener> implements MyModelListener {

 

                               public void dataChanged(Object bean) {

                                               for (MyModelListener l :
this) {

 
l.dataChanged(bean);

                                               }


                               }

                }

}              

 

However - since I am totally new to Pivot, I would like to validate that
this is correct approach, there is no simpler or standard way of
implementing the binding between model and view in Pivot, and this should
still work in new Pivot releases.

 

It seems to me like undocumented feature, so I would like to get little more
confidence I am on the right way.

 

Thanks in advance for your reply.

 

Regards

 

Karel

 


Mime
View raw message