From f3fd2e67fca0b10d70db59c328f8f1e19617c633 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Fri, 26 Feb 2016 15:40:36 -0800 Subject: [PATCH] [Templates] Watch for selection object ...from Timeline, to ensure toolbar appears etc. Reflects changes to ordering triggered by use of template instead of templateUrl --- .../src/controllers/TimelineController.js | 5 ++++- .../swimlane/TimelineSwimlanePopulator.js | 16 +++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/platform/features/timeline/src/controllers/TimelineController.js b/platform/features/timeline/src/controllers/TimelineController.js index 8667bfec5f..c2cd25bc5e 100644 --- a/platform/features/timeline/src/controllers/TimelineController.js +++ b/platform/features/timeline/src/controllers/TimelineController.js @@ -98,10 +98,13 @@ define( }); } } - + // Recalculate swimlane state on changes $scope.$watch("domainObject", swimlanePopulator.populate); + // Pass selection object into swimlane populator + $scope.$watch("selection", swimlanePopulator.selection); + // Also recalculate whenever anything in view is modified $scope.$watch(modificationSum, repopulateSwimlanes); diff --git a/platform/features/timeline/src/controllers/swimlane/TimelineSwimlanePopulator.js b/platform/features/timeline/src/controllers/swimlane/TimelineSwimlanePopulator.js index a15d97196f..0875c87d5a 100644 --- a/platform/features/timeline/src/controllers/swimlane/TimelineSwimlanePopulator.js +++ b/platform/features/timeline/src/controllers/swimlane/TimelineSwimlanePopulator.js @@ -46,7 +46,8 @@ define( start = Number.POSITIVE_INFINITY, end = Number.NEGATIVE_INFINITY, colors = (configuration.colors || {}), - assigner = new TimelineColorAssigner(colors); + assigner = new TimelineColorAssigner(colors), + lastDomainObject; // Track extremes of start/end times function trackStartEnd(timespan) { @@ -144,12 +145,25 @@ define( domainObject && new TimelineProxy(domainObject, selection) ); } + + lastDomainObject = domainObject; + } + + function setSelectionObject(s) { + selection = s; + recalculateSwimlanes(lastDomainObject); } // Ensure colors are exposed in configuration configuration.colors = colors; return { + /** + * Set the selection object associated with this timeline view. + * @param {Object} selection the selection object + */ + selection: setSelectionObject, + /** * Update list of swimlanes to match those reachable from this * object.