[Containment] Enforce containment rules in locator
Enforce containment rules in locator; WTD-962.
This commit is contained in:
@@ -17,13 +17,25 @@ define(
|
||||
// the full tree
|
||||
// * treeModel: The model for the embedded tree representation,
|
||||
// used for bi-directional object selection.
|
||||
function setLocatingObject(domainObject) {
|
||||
function setLocatingObject(domainObject, priorObject) {
|
||||
var context = domainObject &&
|
||||
domainObject.getCapability("context");
|
||||
|
||||
$scope.rootObject = context && context.getRoot();
|
||||
$scope.rootObject = (context && context.getRoot()) || $scope.rootObject;
|
||||
$scope.treeModel.selectedObject = domainObject;
|
||||
$scope.ngModel[$scope.field] = domainObject;
|
||||
|
||||
// Restrict which locations can be selected
|
||||
if (domainObject &&
|
||||
$scope.structure &&
|
||||
$scope.structure.validate) {
|
||||
if (!$scope.structure.validate(domainObject)) {
|
||||
setLocatingObject(
|
||||
$scope.structure.validate(priorObject) ?
|
||||
priorObject : undefined
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Initial state for the tree's model
|
||||
|
||||
Reference in New Issue
Block a user