From 2946f2e8c3742d0f3bbdd767b138c41ebc3cb767 Mon Sep 17 00:00:00 2001 From: Stefano Mazzocchi Date: Sat, 13 Mar 2010 09:32:06 +0000 Subject: [PATCH] - renamed facet-based-edit-dialog -> clustering-dialog - added help in case the clustering dialog comes up with no clusters - changed 'remove' -> (x) button for text facet git-svn-id: http://google-refine.googlecode.com/svn/trunk@291 7d457c2a-affb-35e4-300a-418c747d4874 --- src/main/webapp/about.html | 1 + src/main/webapp/project.html | 2 +- ...ed-edit-dialog.js => clustering-dialog.js} | 182 +++++++++--------- src/main/webapp/scripts/facets/list-facet.js | 2 +- .../scripts/facets/text-search-facet.js | 12 +- .../views/data-table-column-header-ui.js | 2 +- .../styles/dialogs/clustering-dialog.css | 72 +++++++ .../dialogs/facet-based-edit-dialog.css | 72 ------- 8 files changed, 180 insertions(+), 165 deletions(-) create mode 100644 src/main/webapp/about.html rename src/main/webapp/scripts/dialogs/{facet-based-edit-dialog.js => clustering-dialog.js} (72%) create mode 100644 src/main/webapp/styles/dialogs/clustering-dialog.css delete mode 100644 src/main/webapp/styles/dialogs/facet-based-edit-dialog.css diff --git a/src/main/webapp/about.html b/src/main/webapp/about.html new file mode 100644 index 000000000..2d0be673d --- /dev/null +++ b/src/main/webapp/about.html @@ -0,0 +1 @@ + About Gridworks

Gridworks

Credits

Special Thanks

\ No newline at end of file diff --git a/src/main/webapp/project.html b/src/main/webapp/project.html index 122f1a955..871bbb5f0 100644 --- a/src/main/webapp/project.html +++ b/src/main/webapp/project.html @@ -1 +1 @@ - Gridworks
starting up ...
\ No newline at end of file + Gridworks
starting up ...
\ No newline at end of file diff --git a/src/main/webapp/scripts/dialogs/facet-based-edit-dialog.js b/src/main/webapp/scripts/dialogs/clustering-dialog.js similarity index 72% rename from src/main/webapp/scripts/dialogs/facet-based-edit-dialog.js rename to src/main/webapp/scripts/dialogs/clustering-dialog.js index ff6d405f1..9408e579c 100644 --- a/src/main/webapp/scripts/dialogs/facet-based-edit-dialog.js +++ b/src/main/webapp/scripts/dialogs/clustering-dialog.js @@ -1,4 +1,4 @@ -function FacetBasedEditDialog(columnName, expression) { +function ClusteringDialog(columnName, expression) { this._columnName = columnName; this._expression = expression; this._method = "binning"; @@ -11,7 +11,7 @@ function FacetBasedEditDialog(columnName, expression) { this._cluster(); } -FacetBasedEditDialog.prototype._createDialog = function() { +ClusteringDialog.prototype._createDialog = function() { var self = this; var frame = DialogSystem.createDialog(); frame.width("900px"); @@ -62,7 +62,7 @@ FacetBasedEditDialog.prototype._createDialog = function() { '' + '' + '' + - '
' + + '
' + '' + '' + '' + @@ -133,75 +133,85 @@ FacetBasedEditDialog.prototype._createDialog = function() { $("#recon-dialog-tabs-strict").css("display", ""); }; -FacetBasedEditDialog.prototype._renderTable = function(clusters) { +ClusteringDialog.prototype._renderTable = function(clusters) { var self = this; var container = this._elmts.tableContainer; - var table = $('
').addClass("facet-based-edit-dialog-entry-table")[0]; - var trHead = table.insertRow(table.rows.length); - trHead.className = "header"; - $(trHead.insertCell(0)).text("Cluster Size"); - $(trHead.insertCell(1)).text("Row Count"); - $(trHead.insertCell(2)).text("Values in Cluster"); - $(trHead.insertCell(3)).text("Merge?"); - $(trHead.insertCell(4)).text("New Cell Value"); - - var renderCluster = function(cluster) { - var tr = table.insertRow(table.rows.length); - tr.className = table.rows.length % 2 == 0 ? "odd" : "even"; + if (clusters.length > 0) { + var table = $('
').addClass("clustering-dialog-entry-table")[0]; - $(tr.insertCell(0)).text(cluster.choices.length); + var trHead = table.insertRow(table.rows.length); + trHead.className = "header"; + $(trHead.insertCell(0)).text("Cluster Size"); + $(trHead.insertCell(1)).text("Row Count"); + $(trHead.insertCell(2)).text("Values in Cluster"); + $(trHead.insertCell(3)).text("Merge?"); + $(trHead.insertCell(4)).text("New Cell Value"); + + var renderCluster = function(cluster) { + var tr = table.insertRow(table.rows.length); + tr.className = table.rows.length % 2 == 0 ? "odd" : "even"; + + $(tr.insertCell(0)).text(cluster.choices.length); + + $(tr.insertCell(1)).text(cluster.rowCount); + + var ul = $(''); + var choices = cluster.choices; + var rowCount = 0; + for (var c = 0; c < choices.length; c++) { + var choice = choices[c]; + var li = $('
  • '); + $('').text(choice.v).click(function() { + var parent = $(this).closest("tr"); + parent.find("input[type='text']").val($(this).text()); + parent.find("input:not(:checked)").attr('checked', true).change(); + return false; + }).appendTo(li); + $('').text("(" + choice.c + " rows)").addClass("clustering-dialog-entry-count").appendTo(li); + rowCount += choice.c; + li.appendTo(ul); + } + $(tr.insertCell(2)).append(ul); + + var editCheck = $('') + .change(function() { + cluster.edit = !cluster.edit; + }).appendTo(tr.insertCell(3)); + + if (cluster.edit) { + editCheck.attr("checked", "true"); + } + + var input = $('') + .attr("value", cluster.value) + .keyup(function() { + cluster.value = this.value; + }).appendTo(tr.insertCell(4)); + }; - $(tr.insertCell(1)).text(cluster.rowCount); - - var ul = $('