Revision history [back]

click to hide/show revision 1
initial version

answered 2014-03-14 06:48:44 +0800

chillworld gravatar image chillworld flag of Belgium

https://github.com/chillw...

Actually, BindUtils can be more powerfull then @NotifyChanged If you are gonna use it in the same way I don't think there is a big difference.

When shall be there a difference?

Now, when will there a difference? Assume you have a list what you get with this :

public List<User> getUsers() {
    return users;
}

Assume that we have buttons next to each user and the button fires a command that changes that user (like blocking that user) What we can do is put the @notifyChanged("users") what will mean in zk asking getUsers();

If we use BindUtils we can do the following :

BindUtils.postNotifyChanged(null,null,user,"*");

or

BindUtils.postNotifyCHanged(null,null,user,"blocked");

Even we don't have a getter for that user in our VM this will still be executed and only that user in the whole list will update. With the first command all data is refreshed, with the second only the blocked is updated. Now the second isn't always possible cause maybe you don't know what field of all fields is updated but still you update 1 user in stead of getting all x users.

greetz chill.

Actually, BindUtils can be more powerfull then @NotifyChanged If you are gonna use it in the same way I don't think there is a big difference.

When shall be there a difference?

Now, when will there a difference?
Assume you have a list what you get with this :

public List<User> getUsers() {
    return users;
}

Assume that we have buttons next to each user and the button fires a command that changes that user (like blocking that user) What we can do is put the @notifyChanged("users") what will mean in zk asking getUsers();

If we use BindUtils we can do the following :

BindUtils.postNotifyChanged(null,null,user,"*");

or

BindUtils.postNotifyCHanged(null,null,user,"blocked");

Even we don't have a getter for that user in our VM this will still be executed and only that user in the whole list will update. With the first command all data is refreshed, with the second only the blocked is updated. Now the second isn't always possible cause maybe you don't know what field of all fields is updated but still you update 1 user in stead of getting all x users.

greetz chill.

Actually, BindUtils can be more powerfull then @NotifyChanged If you are gonna use it in the same way I don't think there is a big difference.

Now, when will there a difference?
Assume you have a list what you get with this :

public List<User> getUsers() {
    return users;
}

Assume that we have buttons next to each user and the button fires a command that changes that user (like blocking that user) What we can do is put the @notifyChanged("users") what will mean in zk asking getUsers();

If we use BindUtils we can do the following :

BindUtils.postNotifyChanged(null,null,user,"*");

or

BindUtils.postNotifyCHanged(null,null,user,"blocked");

Where blocked stands for a getter inside the User object.

Even we don't have a getter for that user in our VM this will still be executed and only that user in the whole list will update. With the first command all data is refreshed, with the second only the blocked is updated. Now the second isn't always possible cause maybe you don't know what field of all fields is updated but still you update 1 user in stead of getting all x users.

greetz chill.

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More