Skip to content

Commit

Permalink
Merge fe2506a into 278e2ac
Browse files Browse the repository at this point in the history
  • Loading branch information
peuter committed Mar 9, 2019
2 parents 278e2ac + fe2506a commit 6ae4803
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
14 changes: 10 additions & 4 deletions source/class/cv/plugins/diagram/AbstractDiagram.js
Expand Up @@ -460,11 +460,17 @@ qx.Class.define('cv.plugins.diagram.AbstractDiagram', {
* Start the refresh timer
*
* @param timer {qx.event.Timer} start this timer
* @param runImmediately {Boolean} fire the timers 'interval' event immediately to trigger an refresh right now
* @protected
*/
_startRefresh: function(timer) {
if (timer && !timer.isEnabled()) {
timer.start();
_startRefresh: function(timer, runImmediately) {
if (timer) {
if (!timer.isEnabled()) {
timer.start();
}
if (runImmediately === true) {
timer.fireEvent('interval');
}
}
},

Expand Down Expand Up @@ -499,7 +505,7 @@ qx.Class.define('cv.plugins.diagram.AbstractDiagram', {

this.initDiagram( true );

this._startRefresh(this._timerPopup);
this._startRefresh(this._timerPopup, true);
},

initDiagram: function( isPopup ) {
Expand Down
4 changes: 2 additions & 2 deletions source/class/cv/plugins/diagram/Diagram.js
Expand Up @@ -101,13 +101,13 @@ qx.Class.define('cv.plugins.diagram.Diagram', {
}
}, this);

broker.subscribe("path." + pageId + ".appear", function () {
broker.subscribe("page." + pageId + ".appear", function () {
// create diagram when it's not already existing
if (this._init) {
this.initDiagram(false);
}
// start refreshing when page is entered
this._startRefresh(this._timer);
this._startRefresh(this._timer, true);
}, this);

// initialize the diagram but don't make the initialization process wait for it
Expand Down
4 changes: 3 additions & 1 deletion source/class/cv/ui/common/Refresh.js
Expand Up @@ -36,7 +36,7 @@ qx.Mixin.define("cv.ui.common.Refresh", {

// Stop the while invisible
this.addListener("changeVisible", function(ev) {
if (this._timer && ev.getData() !== ev.getOldData()) {
if (this._timer && ev.getData() !== ev.getOldData() && this.__ownTimerId === this._timer.toHashCode()) {
if (ev.getData()) {
this._timer.start();
} else {
Expand Down Expand Up @@ -70,6 +70,7 @@ qx.Mixin.define("cv.ui.common.Refresh", {
members: {
_timer: null,
__setup: false,
__ownTimerId: null,

setupRefreshAction: function () {
if (this.getRefresh() && this.getRefresh() > 0) {
Expand All @@ -92,6 +93,7 @@ qx.Mixin.define("cv.ui.common.Refresh", {
this.refreshAction(target, src);
}, this);
this._timer.start();
this.__ownTimerId = this._timer.toHashCode();
}
}
},
Expand Down

0 comments on commit 6ae4803

Please sign in to comment.