Skip to content

Commit

Permalink
Modify ERMODEditRelationshipPage to support ERMDAjaxNotificationCenter.
Browse files Browse the repository at this point in the history
  • Loading branch information
fbarthez committed Dec 12, 2015
1 parent 9f67d86 commit 8c4b297
Showing 1 changed file with 27 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.webobjects.appserver.WOContext;
import com.webobjects.appserver.WODisplayGroup;
import com.webobjects.directtoweb.D2W;
import com.webobjects.directtoweb.ERD2WUtilities;
import com.webobjects.directtoweb.EditPageInterface;
import com.webobjects.directtoweb.NextPageDelegate;
import com.webobjects.directtoweb.SelectPageInterface;
Expand Down Expand Up @@ -40,7 +41,9 @@
import er.extensions.foundation.ERXArrayUtilities;
import er.extensions.foundation.ERXStringUtilities;
import er.extensions.foundation.ERXValueUtilities;
import er.modern.directtoweb.components.ERMDAjaxNotificationCenter;
import er.modern.directtoweb.components.buttons.ERMDActionButton;
import er.modern.directtoweb.components.repetitions.ERMDInspectPageRepetition;
import er.modern.directtoweb.interfaces.ERMEditRelationshipPageInterface;

/**
Expand Down Expand Up @@ -163,7 +166,9 @@ public WOComponent saveAction() {
relationshipDisplayGroup().displayBatchContainingSelectedObject();
}
}
setInlineTaskSafely(null);
setInlineTaskSafely(null);
// support for ERMDAjaxNotificationCenter
postChangeNotification();
return null;
}

Expand All @@ -182,6 +187,8 @@ public WOComponent selectAction() {
relationshipDisplayGroup().displayBatchContainingSelectedObject();
}

// support for ERMDAjaxNotificationCenter
postChangeNotification();
return null;
}

Expand All @@ -200,6 +207,9 @@ public WOComponent returnAction() {

result = (WOComponent)D2W.factory().editPageForEntityNamed(masterObject().entityName(), session());
((EditPageInterface)result).setObject(masterObject());

// support for ERMDAjaxNotificationCenter
postChangeNotification();
return result;
}

Expand All @@ -217,8 +227,23 @@ public void relatedObjectDidChange(NSNotification notif) {
relationshipDisplayGroup().fetch();
}
}
if (notif.userInfo().valueForKey("ajaxNotificationCenterId") == null) {
// the change notification was not sent from ERMDAjaxNotificationCenter
postChangeNotification();
}
}


private void postChangeNotification() {
ERMDInspectPageRepetition parent = ERD2WUtilities.enclosingComponentOfClass(this,
ERMDInspectPageRepetition.class);
if (ERXValueUtilities.booleanValueWithDefault(
parent.valueForKeyPath("d2wContext.shouldObserve"), false)) {
NSNotificationCenter.defaultCenter().postNotification(
ERMDAjaxNotificationCenter.PropertyChangedNotification,
parent.valueForKeyPath("d2wContext"));
}
}

// COMPONENT DISPLAY CONTROLS

/**
Expand Down

0 comments on commit 8c4b297

Please sign in to comment.