diff --git a/platform/features/timeline/src/controllers/TimelineController.js b/platform/features/timeline/src/controllers/TimelineController.js index 796807c76a..64900b586c 100644 --- a/platform/features/timeline/src/controllers/TimelineController.js +++ b/platform/features/timeline/src/controllers/TimelineController.js @@ -97,6 +97,8 @@ define( } } + $scope.$watch("configuration", swimlanePopulator.configure); + // Recalculate swimlane state on changes $scope.$watch("domainObject", swimlanePopulator.populate); diff --git a/platform/features/timeline/src/controllers/swimlane/TimelineSwimlanePopulator.js b/platform/features/timeline/src/controllers/swimlane/TimelineSwimlanePopulator.js index ccc6148997..74c28b46b8 100644 --- a/platform/features/timeline/src/controllers/swimlane/TimelineSwimlanePopulator.js +++ b/platform/features/timeline/src/controllers/swimlane/TimelineSwimlanePopulator.js @@ -43,8 +43,7 @@ define( var swimlanes = [], start = Number.POSITIVE_INFINITY, end = Number.NEGATIVE_INFINITY, - colors = (configuration.colors || {}), - assigner = new TimelineColorAssigner(colors), + assigner, lastDomainObject; // Track extremes of start/end times @@ -152,8 +151,15 @@ define( recalculateSwimlanes(lastDomainObject); } + function initialize() { + var colors = (configuration.colors || {}); + assigner = new TimelineColorAssigner(colors); + configuration.colors = colors; + recalculateSwimlanes(lastDomainObject); + } + // Ensure colors are exposed in configuration - configuration.colors = colors; + initialize(); return { /** @@ -188,6 +194,15 @@ define( */ end: function () { return end; + }, + /** + * Pass a new configuration object (to retrieve and store + * swimlane configuration) + * @param newConfig + */ + configure: function (newConfig) { + configuration = newConfig; + initialize(); } }; }