0

Problem with 'NotifyChange' and 'Messagebox'?

asked 2012-09-11 19:51:13 +0800

davout gravatar image davout
1435 3 18

updated 2012-09-11 19:56:07 +0800

I have a MVVM class method handling a user action to delete an entry. The code inside the MVVM class method displays a messagebox to prompt a confirmation from the user.

The use of this messagebox seems to interfere with the 'NotifyChange' related updates.

@SuppressWarnings({ "rawtypes", "unchecked" })
@Command("deleteSelected")
@NotifyChange({"locationModel","selectedLocation","showEdit"})
public void deleteSelected() {
   if (getSelectedLocation() != null) {
      try {
         if (geoLocationManager.isUsed(getSelectedLocation().getData().getID())) {
            Messagebox.show("This Location cannot be deleted as it is being used by requirements or available resources","Delete", Messagebox.OK, Messagebox.INFORMATION);
         }
         else {
            Messagebox.show("Confirm deletion of ["+getSelectedLocation().getData().getTitle()+"]?", "Confirm Dialog", Messagebox.OK | Messagebox.CANCEL,
						Messagebox.QUESTION, new org.zkoss.zk.ui.event.EventListener() {
               public void onEvent(Event evt) throws InterruptedException {
                  if (evt.getName().equals("onOK")) {
                     try {
                        geoLocationManager.delete(getSelectedLocation().getData().getID());
                        buildModel();
                        setSelectedLocation(null);
                        BindUtils.postNotifyChange(DataAreaIDs.QUEUE_NAME,DataAreaIDs.QUEUE_SCOPE,this,"showEdit"); 
                        BindUtils.postNotifyChange(DataAreaIDs.QUEUE_NAME,DataAreaIDs.QUEUE_SCOPE,this,"locationModel"); 
                     }
                     catch (PersistenceException e) {
                        showErrorView(getCommand(), e);
                     }
                     catch (UnknownGeoLocationException e) {
                     }
                  }
               }
             });
	}
}
catch (PersistenceException e) {
   showErrorView(getCommand(), e);
}
		}
	}




I've even tried forcing the refresh using the 'bindUtils' calls, but the view remains unaffected.

Any ideas?

delete flag offensive retag edit

11 Replies

Sort by ยป oldest newest

answered 2020-04-09 23:35:57 +0800

smoothblood gravatar image smoothblood
1 1

updated 2020-04-09 23:37:22 +0800

org.zkoss.bind.BindUtils.postNotifyChange(null, null, YourViewModelName.this, "*");

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2012-09-11 19:51:13 +0800

Seen: 451 times

Last updated: Apr 09 '20

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