[Common UI] Add JSDoc
Add JSDoc to classes from commonUI bundles. WTD-574.
This commit is contained in:
@@ -11,37 +11,63 @@ define(
|
||||
var ROOT_OBJECT = "ROOT";
|
||||
|
||||
/**
|
||||
* The BrowseController is used to populate the initial scope in Browse
|
||||
* mode. It loads the root object from the objectService and makes it
|
||||
* available in the scope for Angular template's; this is the point at
|
||||
* which Angular templates first have access to the domain object
|
||||
* hierarchy.
|
||||
*
|
||||
* @constructor
|
||||
*/
|
||||
function BrowseController($scope, objectService, navigationService) {
|
||||
// Callback for updating the in-scope reference to the object
|
||||
// that is currently navigated-to.
|
||||
function setNavigation(domainObject) {
|
||||
$scope.navigatedObject = domainObject;
|
||||
//$scope.$apply("navigatedObject");
|
||||
}
|
||||
|
||||
// Load the root object, put it in the scope.
|
||||
// Also, load its immediate children, and (possibly)
|
||||
// navigate to one of them, so that navigation state has
|
||||
// a useful initial value.
|
||||
objectService.getObjects([ROOT_OBJECT]).then(function (objects) {
|
||||
var composition = objects[ROOT_OBJECT].useCapability("composition");
|
||||
$scope.domainObject = objects[ROOT_OBJECT];
|
||||
if (composition) {
|
||||
composition.then(function (c) {
|
||||
// Navigate to the last root level component (usually "mine")
|
||||
// Check if an object has been navigated-to already...
|
||||
if (!navigationService.getNavigation()) {
|
||||
// If not, pick a default as the last
|
||||
// root-level component (usually "mine")
|
||||
navigationService.setNavigation(c[c.length - 1]);
|
||||
} else {
|
||||
// Otherwise, just expose it in the scope
|
||||
$scope.navigatedObject = navigationService.getNavigation();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Listen for changes in navigation state.
|
||||
navigationService.addListener(setNavigation);
|
||||
|
||||
// Clean up when the scope is destroyed
|
||||
$scope.$on("$destroy", function () {
|
||||
navigationService.removeListener(setNavigation);
|
||||
});
|
||||
|
||||
navigationService.addListener(setNavigation);
|
||||
|
||||
return {
|
||||
/**
|
||||
* Navigate to a specific domain object.
|
||||
*
|
||||
* This is exposed so that the browse tree has a callback
|
||||
* to invoke when the user clicks on a new object to navigate
|
||||
* to it.
|
||||
*
|
||||
* @method
|
||||
* @memberof BrowseController
|
||||
* @param {DomainObject} domainObject the object to navigate to
|
||||
*/
|
||||
setNavigation: function (domainObject) {
|
||||
navigationService.setNavigation(domainObject);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user