Added dispose method to facets so they can clean up themselves.
git-svn-id: http://google-refine.googlecode.com/svn/trunk@495 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
parent
98f12544de
commit
d61473e989
@ -20,6 +20,9 @@ ListFacet.reconstruct = function(div, uiState) {
|
|||||||
return new ListFacet(div, uiState.c, uiState.o, uiState.s);
|
return new ListFacet(div, uiState.c, uiState.o, uiState.s);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
ListFacet.prototype.dispose = function() {
|
||||||
|
};
|
||||||
|
|
||||||
ListFacet.prototype.reset = function() {
|
ListFacet.prototype.reset = function() {
|
||||||
this._selection = [];
|
this._selection = [];
|
||||||
this._blankChoice = null;
|
this._blankChoice = null;
|
||||||
|
@ -53,6 +53,9 @@ RangeFacet.reconstruct = function(div, uiState) {
|
|||||||
return new RangeFacet(div, uiState.c, uiState.o);
|
return new RangeFacet(div, uiState.c, uiState.o);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
RangeFacet.prototype.dispose = function() {
|
||||||
|
};
|
||||||
|
|
||||||
RangeFacet.prototype.getUIState = function() {
|
RangeFacet.prototype.getUIState = function() {
|
||||||
var json = {
|
var json = {
|
||||||
c: this.getJSON(),
|
c: this.getJSON(),
|
||||||
@ -62,7 +65,6 @@ RangeFacet.prototype.getUIState = function() {
|
|||||||
return json;
|
return json;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
RangeFacet.prototype.getJSON = function() {
|
RangeFacet.prototype.getJSON = function() {
|
||||||
var o = {
|
var o = {
|
||||||
type: "range",
|
type: "range",
|
||||||
|
@ -19,6 +19,10 @@ ScatterplotFacet.reconstruct = function(div, uiState) {
|
|||||||
return new ScatterplotFacet(div, uiState.c, uiState.o);
|
return new ScatterplotFacet(div, uiState.c, uiState.o);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
ScatterplotFacet.prototype.dispose = function() {
|
||||||
|
this._plotImg.imgAreaSelect({ hide : true });
|
||||||
|
};
|
||||||
|
|
||||||
ScatterplotFacet.prototype.getUIState = function() {
|
ScatterplotFacet.prototype.getUIState = function() {
|
||||||
var json = {
|
var json = {
|
||||||
c: this.getJSON(),
|
c: this.getJSON(),
|
||||||
|
@ -13,6 +13,9 @@ TextSearchFacet.reconstruct = function(div, uiState) {
|
|||||||
return new TextSearchFacet(div, uiState.c, uiState.o);
|
return new TextSearchFacet(div, uiState.c, uiState.o);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
TextSearchFacet.prototype.dispose = function() {
|
||||||
|
};
|
||||||
|
|
||||||
TextSearchFacet.prototype.reset = function() {
|
TextSearchFacet.prototype.reset = function() {
|
||||||
this._query = null;
|
this._query = null;
|
||||||
this._div.find(".input-container input").each(function() { this.value = ""; });
|
this._div.find(".input-container input").each(function() { this.value = ""; });
|
||||||
|
@ -140,16 +140,18 @@ BrowsingEngine.prototype._createFacetContainer = function() {
|
|||||||
BrowsingEngine.prototype.removeFacet = function(facet) {
|
BrowsingEngine.prototype.removeFacet = function(facet) {
|
||||||
var update = facet.hasSelection();
|
var update = facet.hasSelection();
|
||||||
for (var i = this._facets.length - 1;i >= 0; i--) {
|
for (var i = this._facets.length - 1;i >= 0; i--) {
|
||||||
if (this._facets[i].facet === facet) {
|
var facetRecord = this._facets[i];
|
||||||
var elmt = this._facets[i].elmt;
|
if (facetRecord.facet === facet) {
|
||||||
this._facets.splice(i, 1);
|
this._facets.splice(i, 1);
|
||||||
|
|
||||||
|
facetRecord.facet.dispose();
|
||||||
|
|
||||||
// This makes really big facet disappear right away. If you just call remove()
|
// This makes really big facet disappear right away. If you just call remove()
|
||||||
// then it takes a while for all the event handlers to get unwired, and the UI
|
// then it takes a while for all the event handlers to get unwired, and the UI
|
||||||
// appear frozen.
|
// appear frozen.
|
||||||
elmt.hide();
|
facetRecord.elmt.hide();
|
||||||
window.setTimeout(function() {
|
window.setTimeout(function() {
|
||||||
elmt.remove();
|
facetRecord.elmt.remove();
|
||||||
}, 300);
|
}, 300);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -207,7 +209,9 @@ BrowsingEngine.prototype.remove = function() {
|
|||||||
this._facets = [];
|
this._facets = [];
|
||||||
|
|
||||||
for (var i = 0; i < oldFacets.length; i++) {
|
for (var i = 0; i < oldFacets.length; i++) {
|
||||||
oldFacets[i].elmt.hide();
|
var facet = oldFacets[i];
|
||||||
|
facet.facet.dispose();
|
||||||
|
facet.elmt.hide();
|
||||||
}
|
}
|
||||||
window.setTimeout(function() {
|
window.setTimeout(function() {
|
||||||
for (var i = 0; i < oldFacets.length; i++) {
|
for (var i = 0; i < oldFacets.length; i++) {
|
||||||
|
Loading…
Reference in New Issue
Block a user