more polish on the clustering dialog
git-svn-id: http://google-refine.googlecode.com/svn/trunk@260 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
parent
6b3a20dc46
commit
0c4b79c53a
@ -55,7 +55,7 @@ public class BinningClusterer extends Clusterer {
|
||||
_params = new Object[1];
|
||||
_params[0] = size;
|
||||
} catch (JSONException e) {
|
||||
//Gridworks.warn("no ngram size specified, using default");
|
||||
//Gridworks.warn("No params specified, using default");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ public class NGramFingerprintKeyer extends Keyer {
|
||||
static final Pattern alphanum = Pattern.compile("\\p{Punct}|\\p{Cntrl}|\\p{Space}");
|
||||
|
||||
public String key(String s, Object... o) {
|
||||
int ngram_size = 1;
|
||||
int ngram_size = 2;
|
||||
if (o != null && o.length > 0 && o[0] instanceof Number) {
|
||||
ngram_size = (Integer) o[0];
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ public class kNNClusterer extends Clusterer {
|
||||
JSONObject params = o.getJSONObject("params");
|
||||
_radius = params.getDouble("radius");
|
||||
} catch (JSONException e) {
|
||||
Gridworks.warn("No parameters found, using defaults");
|
||||
//Gridworks.warn("No parameters found, using defaults");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,14 @@ FacetBasedEditDialog.prototype._createDialog = function() {
|
||||
|
||||
var header = $('<div></div>').addClass("dialog-header").text("Cluster & Edit column " + this._columnName).appendTo(frame);
|
||||
var body = $('<div></div>').addClass("dialog-body").appendTo(frame);
|
||||
var footer = $('<div></div>').addClass("dialog-footer").appendTo(frame);
|
||||
var footer = $(
|
||||
'<div class="dialog-footer">' +
|
||||
'<table width="100%"><tr>' +
|
||||
'<td class="left" style="text-align: left"></td>' +
|
||||
'<td class="right" style="text-align: right"></td>' +
|
||||
'</tr></table>' +
|
||||
'</div>'
|
||||
).appendTo(frame);
|
||||
|
||||
var html = $(
|
||||
'<div>' +
|
||||
@ -51,7 +58,7 @@ FacetBasedEditDialog.prototype._createDialog = function() {
|
||||
'</td>' +
|
||||
'<td>' +
|
||||
'<div id="ngram-fingerprint-params" class="function-params hidden">' +
|
||||
'Ngram Size: <input type="text" value="1" bind="ngramSize" size="3">' +
|
||||
'Ngram Size: <input type="text" value="2" bind="ngramSize" size="3">' +
|
||||
'</div>' +
|
||||
'<div class="knn-controls hidden">' +
|
||||
'<span style="margin-right: 1em">Radius: <input type="text" value="1.0" bind="radius" size="3"></span>' +
|
||||
@ -127,10 +134,15 @@ FacetBasedEditDialog.prototype._createDialog = function() {
|
||||
|
||||
//this._elmts.clusterButton.click(function() { self._cluster(); });
|
||||
//this._elmts.unclusterButton.click(function() { self._uncluster(); });
|
||||
|
||||
var left_footer = footer.find(".left");
|
||||
$('<button></button>').text("Select All").click(function() { self._selectAll(); }).appendTo(left_footer);
|
||||
$('<button></button>').text("Deselect All").click(function() { self._deselectAll(); }).appendTo(left_footer);
|
||||
|
||||
$('<button></button>').text("Apply & Re-Cluster").click(function() { self._onApplyReCluster(); }).appendTo(footer);
|
||||
$('<button></button>').text("Apply & Close").click(function() { self._onApplyClose(); }).appendTo(footer);
|
||||
$('<button></button>').text("Close").click(function() { self._dismiss(); }).appendTo(footer);
|
||||
var right_footer = footer.find(".right");
|
||||
$('<button></button>').text("Apply & Re-Cluster").click(function() { self._onApplyReCluster(); }).appendTo(right_footer);
|
||||
$('<button></button>').text("Apply & Close").click(function() { self._onApplyClose(); }).appendTo(right_footer);
|
||||
$('<button></button>').text("Close").click(function() { self._dismiss(); }).appendTo(right_footer);
|
||||
|
||||
this._level = DialogSystem.showDialog(frame);
|
||||
|
||||
@ -175,7 +187,7 @@ FacetBasedEditDialog.prototype._renderTable = function(clusters) {
|
||||
|
||||
var editCheck = $('<input type="checkbox" />')
|
||||
.appendTo(tr.insertCell(3))
|
||||
.click(function() {
|
||||
.change(function() {
|
||||
cluster.edit = !cluster.edit;
|
||||
});
|
||||
if (cluster.edit) {
|
||||
@ -195,10 +207,10 @@ FacetBasedEditDialog.prototype._renderTable = function(clusters) {
|
||||
|
||||
container.empty().append(table);
|
||||
|
||||
this._elmts.resultSummary.text(
|
||||
this._elmts.resultSummary.html(
|
||||
(clusters.length === this._clusters.length) ?
|
||||
(this._clusters.length + " clusters found.") :
|
||||
(clusters.length + " clusters filtered from " + this._clusters.length + " total.")
|
||||
("<b>" + this._clusters.length + "</b> cluster" + ((this._clusters.length != 1) ? "s" : "") + " found") :
|
||||
("<b>" + clusters.length + "</b> cluster" + ((clusters.length != 1) ? "s" : "") + " filtered from <b>" + this._clusters.length + "</b> total")
|
||||
);
|
||||
};
|
||||
|
||||
@ -206,7 +218,7 @@ FacetBasedEditDialog.prototype._cluster = function() {
|
||||
var self = this;
|
||||
|
||||
var container = this._elmts.tableContainer.html(
|
||||
'<div style="margin: 1em; font-size: 130%; color: #888;">Loading... <img src="/images/small-spinner.gif"></div>'
|
||||
'<div style="margin: 1em; font-size: 130%; color: #888;">Clustering... <img src="/images/small-spinner.gif"></div>'
|
||||
);
|
||||
|
||||
this._elmts.resultSummary.empty();
|
||||
@ -233,7 +245,7 @@ FacetBasedEditDialog.prototype._updateData = function(data) {
|
||||
var clusters = [];
|
||||
$.each(data, function() {
|
||||
var cluster = {
|
||||
edit: true,
|
||||
edit: false,
|
||||
choices: this,
|
||||
value: this[0].v,
|
||||
size: this.length
|
||||
@ -262,6 +274,14 @@ FacetBasedEditDialog.prototype._updateData = function(data) {
|
||||
this._updateAll();
|
||||
};
|
||||
|
||||
FacetBasedEditDialog.prototype._selectAll = function() {
|
||||
$(".facet-based-edit-dialog-entry-table input:not(:checked)").attr('checked', true).change();
|
||||
};
|
||||
|
||||
FacetBasedEditDialog.prototype._deselectAll = function() {
|
||||
$(".facet-based-edit-dialog-entry-table input:checked").attr('checked', false).change();
|
||||
};
|
||||
|
||||
FacetBasedEditDialog.prototype._onApplyClose = function() {
|
||||
var self = this;
|
||||
this._apply(function() {
|
||||
|
Loading…
Reference in New Issue
Block a user