Factored out column header UI and cell UI to prepare for single cell commands.
git-svn-id: http://google-refine.googlecode.com/svn/trunk@79 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
parent
c73ec864db
commit
66457f0515
@ -1,2 +1,2 @@
|
|||||||
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Gridlock</title>
<link type="text/css" rel="stylesheet" href="externals/suggest/css/suggest-1.0.3.min.css" />
<link type="text/css" rel="stylesheet" href="externals/jquery-ui/css/ui-lightness/jquery-ui-1.7.2.custom.css" />
<link rel="stylesheet" href="/styles/common.css" />
<link rel="stylesheet" href="/styles/menu.css" />
<link rel="stylesheet" href="/styles/dialog.css" />
<link rel="stylesheet" href="/styles/project.css" />
<link rel="stylesheet" href="/styles/data-table-view.css" />
<link rel="stylesheet" href="/styles/history.css" />
<link rel="stylesheet" href="/styles/browsing.css" />
<link rel="stylesheet" href="/styles/process.css" />
<link rel="stylesheet" href="/styles/menu-bar.css" />
<link rel="stylesheet" href="/styles/expression-preview-dialog.css" />
<link rel="stylesheet" href="/styles/schema-alignment-dialog.css" />
|
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Gridlock</title>
<link type="text/css" rel="stylesheet" href="externals/suggest/css/suggest-1.0.3.min.css" />
<link type="text/css" rel="stylesheet" href="externals/jquery-ui/css/ui-lightness/jquery-ui-1.7.2.custom.css" />
<link rel="stylesheet" href="/styles/common.css" />
<link rel="stylesheet" href="/styles/menu.css" />
<link rel="stylesheet" href="/styles/dialog.css" />
<link rel="stylesheet" href="/styles/project.css" />
<link rel="stylesheet" href="/styles/data-table-view.css" />
<link rel="stylesheet" href="/styles/history.css" />
<link rel="stylesheet" href="/styles/browsing.css" />
<link rel="stylesheet" href="/styles/process.css" />
<link rel="stylesheet" href="/styles/menu-bar.css" />
<link rel="stylesheet" href="/styles/expression-preview-dialog.css" />
<link rel="stylesheet" href="/styles/schema-alignment-dialog.css" />
|
||||||
<script type="text/javascript" src="externals/jquery-1.4.1.min.js"></script>
<script type="text/javascript" src="externals/suggest/suggest-1.0.3.min.js"></script>
<script type="text/javascript" src="externals/jquery-ui/jquery-ui-1.7.2.custom.min.js"></script>
<script type="text/javascript" src="scripts/util/misc.js"></script>
<script type="text/javascript" src="scripts/util/url.js"></script>
<script type="text/javascript" src="scripts/util/string.js"></script>
<script type="text/javascript" src="scripts/util/ajax.js"></script>
<script type="text/javascript" src="scripts/util/menu.js"></script>
<script type="text/javascript" src="scripts/util/dialog.js"></script>
<script type="text/javascript" src="scripts/project.js"></script>
<script type="text/javascript" src="scripts/project/list-facet.js"></script>
<script type="text/javascript" src="scripts/project/range-facet.js"></script>
<script type="text/javascript" src="scripts/project/text-search-facet.js"></script>
<script type="text/javascript" src="scripts/project/browsing-engine.js"></script>
<script type="text/javascript" src="scripts/project/data-table-view.js"></script>
<script type="text/javascript" src="scripts/project/history-widget.js"></script>
<script type="text/javascript" src="scripts/project/process-widget.js"></script>
<script type="text/javascript" src="scripts/project/menu-bar.js"></script>
<script type="text/javascript" src="scripts/project/recon-dialog.js"></script>
<script type="text/javascript" src="scripts/project/expression-preview-dialog.js"></script>
<script type="text/javascript" src="scripts/project/schema-alignment.js"></script>
</head>
<body>
<div id="header">
<div id="path"><a class="app-path-section" href="./index.html">Gridworks</a> » </div>
</div>
<div id="body">
<div id="loading-message"><img src="images/large-spinner.gif" /> starting up ...</div>
</div>
</body>
</html>
|
<script type="text/javascript" src="externals/jquery-1.4.1.min.js"></script>
<script type="text/javascript" src="externals/suggest/suggest-1.0.3.min.js"></script>
<script type="text/javascript" src="externals/jquery-ui/jquery-ui-1.7.2.custom.min.js"></script>
<script type="text/javascript" src="scripts/util/misc.js"></script>
<script type="text/javascript" src="scripts/util/url.js"></script>
<script type="text/javascript" src="scripts/util/string.js"></script>
<script type="text/javascript" src="scripts/util/ajax.js"></script>
<script type="text/javascript" src="scripts/util/menu.js"></script>
<script type="text/javascript" src="scripts/util/dialog.js"></script>
<script type="text/javascript" src="scripts/project.js"></script>
<script type="text/javascript" src="scripts/project/list-facet.js"></script>
<script type="text/javascript" src="scripts/project/range-facet.js"></script>
<script type="text/javascript" src="scripts/project/text-search-facet.js"></script>
<script type="text/javascript" src="scripts/project/browsing-engine.js"></script>
<script type="text/javascript" src="scripts/project/data-table-view.js"></script>
<script type="text/javascript" src="scripts/project/data-table-cell-ui.js"></script>
<script type="text/javascript" src="scripts/project/data-table-column-header-ui.js"></script>
<script type="text/javascript" src="scripts/project/history-widget.js"></script>
<script type="text/javascript" src="scripts/project/process-widget.js"></script>
<script type="text/javascript" src="scripts/project/menu-bar.js"></script>
<script type="text/javascript" src="scripts/project/recon-dialog.js"></script>
<script type="text/javascript" src="scripts/project/expression-preview-dialog.js"></script>
<script type="text/javascript" src="scripts/project/schema-alignment.js"></script>
</head>
<body>
<div id="header">
<div id="path"><a class="app-path-section" href="./index.html">Gridworks</a> » </div>
</div>
<div id="body">
<div id="loading-message"><img src="images/large-spinner.gif" /> starting up ...</div>
</div>
</body>
</html>
|
51
src/main/webapp/scripts/project/data-table-cell-ui.js
Normal file
51
src/main/webapp/scripts/project/data-table-cell-ui.js
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
function DataTableCellUI(dataTableView, cell, rowIndex, cellIndex, td) {
|
||||||
|
this._dataTableView = dataTableView;
|
||||||
|
this._cell = cell;
|
||||||
|
this._rowIndex = rowIndex;
|
||||||
|
this._cellIndex = cellIndex;
|
||||||
|
this._td = td;
|
||||||
|
|
||||||
|
this._render();
|
||||||
|
};
|
||||||
|
|
||||||
|
DataTableCellUI.prototype._render = function() {
|
||||||
|
var cell = this._cell;
|
||||||
|
var td = this._td;
|
||||||
|
|
||||||
|
if (cell == null || cell.v == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!("r" in cell) || cell.r == null) {
|
||||||
|
$(td).html(cell.v);
|
||||||
|
} else {
|
||||||
|
var r = cell.r;
|
||||||
|
if (r.j == "new") {
|
||||||
|
$(td).html(cell.v + " (new)");
|
||||||
|
} else if (r.j == "approve" && "m" in r && r.m != null) {
|
||||||
|
var match = cell.r.m;
|
||||||
|
$('<a></a>')
|
||||||
|
.attr("href", "http://www.freebase.com/view" + match.id)
|
||||||
|
.attr("target", "_blank")
|
||||||
|
.text(match.name)
|
||||||
|
.appendTo(td);
|
||||||
|
} else {
|
||||||
|
$(td).html(cell.v);
|
||||||
|
if (this._dataTableView._showRecon && "c" in r && r.c.length > 0) {
|
||||||
|
var candidates = r.c;
|
||||||
|
var ul = $('<ul></ul>').appendTo(td);
|
||||||
|
|
||||||
|
for (var i = 0; i < candidates.length; i++) {
|
||||||
|
var candidate = candidates[i];
|
||||||
|
var li = $('<li></li>').appendTo(ul);
|
||||||
|
$('<a></a>')
|
||||||
|
.attr("href", "http://www.freebase.com/view" + candidate.id)
|
||||||
|
.attr("target", "_blank")
|
||||||
|
.text(candidate.name)
|
||||||
|
.appendTo(li);
|
||||||
|
$('<span></span>').addClass("recon-score").text("(" + Math.round(candidate.score) + ")").appendTo(li);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
466
src/main/webapp/scripts/project/data-table-column-header-ui.js
Normal file
466
src/main/webapp/scripts/project/data-table-column-header-ui.js
Normal file
@ -0,0 +1,466 @@
|
|||||||
|
function DataTableColumnHeaderUI(dataTableView, column, columnIndex, td) {
|
||||||
|
this._dataTableView = dataTableView;
|
||||||
|
this._column = column;
|
||||||
|
this._columnIndex = columnIndex;
|
||||||
|
this._td = td;
|
||||||
|
|
||||||
|
this._render();
|
||||||
|
}
|
||||||
|
|
||||||
|
DataTableColumnHeaderUI.prototype._render = function() {
|
||||||
|
var self = this;
|
||||||
|
var td = this._td;
|
||||||
|
|
||||||
|
var headerTable = document.createElement("table");
|
||||||
|
$(headerTable).addClass("column-header-layout").attr("cellspacing", "0").attr("cellpadding", "0").attr("width", "100%").appendTo(td);
|
||||||
|
|
||||||
|
var headerTableRow = headerTable.insertRow(0);
|
||||||
|
var headerLeft = headerTableRow.insertCell(0);
|
||||||
|
var headerRight = headerTableRow.insertCell(1);
|
||||||
|
|
||||||
|
$('<span></span>').html(this._column.headerLabel).appendTo(headerLeft);
|
||||||
|
|
||||||
|
$(headerRight).attr("width", "1%");
|
||||||
|
$('<img src="/images/menu-dropdown.png" />').addClass("column-header-menu").appendTo(headerRight).click(function() {
|
||||||
|
self._createMenuForColumnHeader(this);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
DataTableColumnHeaderUI.prototype._createMenuForColumnHeader = function(elmt) {
|
||||||
|
self = this;
|
||||||
|
MenuSystem.createAndShowStandardMenu([
|
||||||
|
{
|
||||||
|
label: "Edit",
|
||||||
|
submenu: [
|
||||||
|
{ "heading" : "Cell Content Transformations" },
|
||||||
|
{
|
||||||
|
label: "To Titlecase",
|
||||||
|
click: function() { self._doTextTransform("toTitlecase(value)"); }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "To Uppercase",
|
||||||
|
click: function() { self._doTextTransform("toUppercase(value)"); }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "To Lowercase",
|
||||||
|
click: function() { self._doTextTransform("toLowercase(value)"); }
|
||||||
|
},
|
||||||
|
{},
|
||||||
|
{
|
||||||
|
label: "Custom Expression ...",
|
||||||
|
click: function() { self._doTextTransformPrompt(); }
|
||||||
|
},
|
||||||
|
{ "heading" : "Column Operations" },
|
||||||
|
{
|
||||||
|
label: "Add Column Based on This Column ...",
|
||||||
|
click: function() { self._doAddColumn("value"); }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Remove This Column",
|
||||||
|
click: function() { self._doRemoveColumn(); }
|
||||||
|
},
|
||||||
|
{ "heading" : "Advanced Transformations" },
|
||||||
|
{
|
||||||
|
label: "Split Multi-Value Cells ...",
|
||||||
|
click: function() { self._doSplitMultiValueCells(); }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Join Multi-Value Cells ...",
|
||||||
|
click: function() { self._doJoinMultiValueCells(); }
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Filter",
|
||||||
|
tooltip: "Filter rows by this column's cell content or characteristics",
|
||||||
|
submenu: [
|
||||||
|
{
|
||||||
|
label: "Text Facet",
|
||||||
|
click: function() {
|
||||||
|
ui.browsingEngine.addFacet(
|
||||||
|
"list",
|
||||||
|
{
|
||||||
|
"name" : self._column.headerLabel,
|
||||||
|
"cellIndex" : self._column.cellIndex,
|
||||||
|
"expression" : "value"
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Custom Text Facet ...",
|
||||||
|
click: function() { self._doFilterByExpressionPrompt("value", "list"); }
|
||||||
|
},
|
||||||
|
{},
|
||||||
|
{
|
||||||
|
label: "Numeric Facet",
|
||||||
|
click: function() {
|
||||||
|
ui.browsingEngine.addFacet(
|
||||||
|
"range",
|
||||||
|
{
|
||||||
|
"name" : self._column.headerLabel,
|
||||||
|
"cellIndex" : self._column.cellIndex,
|
||||||
|
"expression" : "value",
|
||||||
|
"mode" : "range",
|
||||||
|
"min" : 0,
|
||||||
|
"max" : 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Custom Numeric Facet ...",
|
||||||
|
click: function() { self._doFilterByExpressionPrompt("value", "range"); }
|
||||||
|
},
|
||||||
|
{},
|
||||||
|
{
|
||||||
|
label: "Text Search",
|
||||||
|
click: function() {
|
||||||
|
ui.browsingEngine.addFacet(
|
||||||
|
"text",
|
||||||
|
{
|
||||||
|
"name" : self._column.headerLabel,
|
||||||
|
"cellIndex" : self._column.cellIndex,
|
||||||
|
"mode" : "text",
|
||||||
|
"caseSensitive" : false
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Regular Expression Search",
|
||||||
|
click: function() {
|
||||||
|
ui.browsingEngine.addFacet(
|
||||||
|
"text",
|
||||||
|
{
|
||||||
|
"name" : self._column.headerLabel + " (regex)",
|
||||||
|
"cellIndex" : self._column.cellIndex,
|
||||||
|
"mode" : "regex",
|
||||||
|
"caseSensitive" : true
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "View",
|
||||||
|
tooltip: "Collapse/expand columns to make viewing the data more convenient",
|
||||||
|
submenu: [
|
||||||
|
{
|
||||||
|
label: "Collapse This Column",
|
||||||
|
click: function() {
|
||||||
|
theProject.columnModel.columns[self._columnIndex].collapsed = true;
|
||||||
|
self._dataTableView.render();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Collapse All Other Columns",
|
||||||
|
click: function() {
|
||||||
|
for (var i = 0; i < theProject.columnModel.columns.length; i++) {
|
||||||
|
if (i != self._columnIndex) {
|
||||||
|
theProject.columnModel.columns[i].collapsed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
self._dataTableView.render();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Collapse All Columns To Right",
|
||||||
|
click: function() {
|
||||||
|
for (var i = self._columnIndex + 1; i < theProject.columnModel.columns.length; i++) {
|
||||||
|
theProject.columnModel.columns[i].collapsed = true;
|
||||||
|
}
|
||||||
|
self._dataTableView.render();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{},
|
||||||
|
{
|
||||||
|
label: "Reconcile",
|
||||||
|
tooltip: "Match this column's cells to topics on Freebase",
|
||||||
|
submenu: [
|
||||||
|
{
|
||||||
|
label: "Start Reconciling ...",
|
||||||
|
tooltip: "Reconcile text in this column with topics on Freebase",
|
||||||
|
click: function() {
|
||||||
|
new ReconDialog(self._columnIndex);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{},
|
||||||
|
{
|
||||||
|
label: "Approve Best Candidates",
|
||||||
|
tooltip: "Approve best reconciliaton candidate per cell in this column for all current filtered rows",
|
||||||
|
click: function() {
|
||||||
|
self._doApproveBestCandidates();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Approve As New Topics",
|
||||||
|
tooltip: "Set to create new topics for cells in this column for all current filtered rows",
|
||||||
|
click: function() {
|
||||||
|
self._doApproveNewTopics();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Discard Reconciliation Results",
|
||||||
|
tooltip: "Discard reconciliaton results in this column for all current filtered rows",
|
||||||
|
click: function() {
|
||||||
|
self._doDiscardReconResults();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Reconcile Filter",
|
||||||
|
tooltip: "Match this column's cells to topics on Freebase",
|
||||||
|
submenu: [
|
||||||
|
{
|
||||||
|
label: "By Judgment",
|
||||||
|
click: function() {
|
||||||
|
ui.browsingEngine.addFacet(
|
||||||
|
"list",
|
||||||
|
{
|
||||||
|
"name" : self._column.headerLabel + ": judgment",
|
||||||
|
"cellIndex" : self._column.cellIndex,
|
||||||
|
"expression" : "cell.recon.judgment"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scroll" : false
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{},
|
||||||
|
{
|
||||||
|
label: "Best Candidate's Relevance Score",
|
||||||
|
click: function() {
|
||||||
|
ui.browsingEngine.addFacet(
|
||||||
|
"range",
|
||||||
|
{
|
||||||
|
"name" : self._column.headerLabel + ": best candidate's relevance score",
|
||||||
|
"cellIndex" : self._column.cellIndex,
|
||||||
|
"expression" : "cell.recon.best.score",
|
||||||
|
"mode" : "range",
|
||||||
|
"min" : 0,
|
||||||
|
"max" : 200
|
||||||
|
},
|
||||||
|
{
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Best Candidate's Type Match",
|
||||||
|
click: function() {
|
||||||
|
ui.browsingEngine.addFacet(
|
||||||
|
"list",
|
||||||
|
{
|
||||||
|
"name" : self._column.headerLabel + ": best candidate's type match",
|
||||||
|
"cellIndex" : self._column.cellIndex,
|
||||||
|
"expression" : "cell.recon.features.typeMatch"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scroll" : false
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Best Candidate's Name Match",
|
||||||
|
click: function() {
|
||||||
|
ui.browsingEngine.addFacet(
|
||||||
|
"list",
|
||||||
|
{
|
||||||
|
"name" : self._column.headerLabel + ": best candidate's name match",
|
||||||
|
"cellIndex" : self._column.cellIndex,
|
||||||
|
"expression" : "cell.recon.features.nameMatch"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scroll" : false
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{},
|
||||||
|
{
|
||||||
|
label: "Best Candidate's Name Edit Distance",
|
||||||
|
click: function() {
|
||||||
|
ui.browsingEngine.addFacet(
|
||||||
|
"range",
|
||||||
|
{
|
||||||
|
"name" : self._column.headerLabel + ": best candidate's name edit distance",
|
||||||
|
"cellIndex" : self._column.cellIndex,
|
||||||
|
"expression" : "cell.recon.features.nameLevenshtein",
|
||||||
|
"mode" : "range",
|
||||||
|
"min" : 0,
|
||||||
|
"max" : 1,
|
||||||
|
"step" : 0.1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Best Candidate's Name Word Similarity",
|
||||||
|
click: function() {
|
||||||
|
ui.browsingEngine.addFacet(
|
||||||
|
"range",
|
||||||
|
{
|
||||||
|
"name" : self._column.headerLabel + ": best candidate's name word similarity",
|
||||||
|
"cellIndex" : self._column.cellIndex,
|
||||||
|
"expression" : "cell.recon.features.nameWordDistance",
|
||||||
|
"mode" : "range",
|
||||||
|
"min" : 0,
|
||||||
|
"max" : 1,
|
||||||
|
"step" : 0.1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{},
|
||||||
|
{
|
||||||
|
label: "Best Candidate's Types",
|
||||||
|
click: function() {
|
||||||
|
ui.browsingEngine.addFacet(
|
||||||
|
"list",
|
||||||
|
{
|
||||||
|
"name" : self._column.headerLabel + ": best candidate's types",
|
||||||
|
"cellIndex" : self._column.cellIndex,
|
||||||
|
"expression" : "cell.recon.best.type"
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
], elmt, { width: "120px", horizontal: false });
|
||||||
|
};
|
||||||
|
|
||||||
|
DataTableColumnHeaderUI.prototype._doFilterByExpressionPrompt = function(expression, type) {
|
||||||
|
var self = this;
|
||||||
|
DataTableView.promptExpressionOnVisibleRows(
|
||||||
|
this._column,
|
||||||
|
"Custom Filter on " + this._column.headerLabel,
|
||||||
|
expression,
|
||||||
|
function(expression) {
|
||||||
|
var config = {
|
||||||
|
"name" : self._column.headerLabel + ": " + expression,
|
||||||
|
"cellIndex" : self._column.cellIndex,
|
||||||
|
"expression" : expression
|
||||||
|
};
|
||||||
|
if (type == "range") {
|
||||||
|
config.mode = "range";
|
||||||
|
}
|
||||||
|
|
||||||
|
ui.browsingEngine.addFacet(type, config);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
DataTableColumnHeaderUI.prototype._doTextTransform = function(expression) {
|
||||||
|
this._dataTableView.doPostThenUpdate(
|
||||||
|
"do-text-transform",
|
||||||
|
{ cell: this._column.cellIndex, expression: expression }
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
DataTableColumnHeaderUI.prototype._doTextTransformPrompt = function() {
|
||||||
|
var self = this;
|
||||||
|
DataTableView.promptExpressionOnVisibleRows(
|
||||||
|
this._column,
|
||||||
|
"Custom Transform on " + this._column.headerLabel,
|
||||||
|
"value",
|
||||||
|
function(expression) {
|
||||||
|
self._doTextTransform(expression);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
DataTableColumnHeaderUI.prototype._doDiscardReconResults = function() {
|
||||||
|
this._dataTableView.doPostThenUpdate(
|
||||||
|
"discard-reconcile",
|
||||||
|
{ cell: this._column.cellIndex }
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
DataTableColumnHeaderUI.prototype._doApproveBestCandidates = function() {
|
||||||
|
this._dataTableView.doPostThenUpdate(
|
||||||
|
"approve-reconcile",
|
||||||
|
{ cell: this._column.cellIndex }
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
DataTableColumnHeaderUI.prototype._doApproveNewTopics = function() {
|
||||||
|
this._dataTableView.doPostThenUpdate(
|
||||||
|
"approve-new-reconcile",
|
||||||
|
{ cell: this._column.cellIndex }
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
DataTableColumnHeaderUI.prototype._doAddColumn = function(initialExpression) {
|
||||||
|
var self = this;
|
||||||
|
DataTableView.promptExpressionOnVisibleRows(
|
||||||
|
this._column,
|
||||||
|
"Add Column Based on Column " + this._column.headerLabel,
|
||||||
|
initialExpression,
|
||||||
|
function(expression) {
|
||||||
|
var headerLabel = window.prompt("Enter header label for new column:");
|
||||||
|
if (headerLabel != null) {
|
||||||
|
self._dataTableView.doPostThenUpdate(
|
||||||
|
"add-column",
|
||||||
|
{
|
||||||
|
baseCellIndex: self._column.cellIndex,
|
||||||
|
expression: expression,
|
||||||
|
headerLabel: headerLabel,
|
||||||
|
columnInsertIndex: self._columnIndex + 1
|
||||||
|
},
|
||||||
|
true
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
DataTableColumnHeaderUI.prototype._doRemoveColumn = function() {
|
||||||
|
this._dataTableView.doPostThenUpdate(
|
||||||
|
"remove-column",
|
||||||
|
{ columnRemovalIndex: this._columnIndex },
|
||||||
|
true
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
DataTableColumnHeaderUI.prototype._doJoinMultiValueCells = function() {
|
||||||
|
var separator = window.prompt("Enter separator to use between values", ", ");
|
||||||
|
if (separator != null) {
|
||||||
|
this._dataTableView.doPostThenUpdate(
|
||||||
|
"join-multi-value-cells",
|
||||||
|
{
|
||||||
|
cellIndex: this._column.cellIndex,
|
||||||
|
keyCellIndex: theProject.columnModel.keyCellIndex,
|
||||||
|
separator: separator
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
DataTableColumnHeaderUI.prototype._doSplitMultiValueCells = function() {
|
||||||
|
var separator = window.prompt("What separator currently separates the values?", ", ");
|
||||||
|
if (separator != null) {
|
||||||
|
this._dataTableView.doPostThenUpdate(
|
||||||
|
"split-multi-value-cells",
|
||||||
|
{
|
||||||
|
cellIndex: this._column.cellIndex,
|
||||||
|
keyCellIndex: theProject.columnModel.keyCellIndex,
|
||||||
|
separator: separator,
|
||||||
|
mode: "plain"
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
@ -178,19 +178,7 @@ DataTableView.prototype.render = function() {
|
|||||||
self.render();
|
self.render();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
var headerTable = document.createElement("table");
|
new DataTableColumnHeaderUI(self, column, index, td);
|
||||||
$(headerTable).addClass("column-header-layout").attr("cellspacing", "0").attr("cellpadding", "0").attr("width", "100%").appendTo(td);
|
|
||||||
|
|
||||||
var headerTableRow = headerTable.insertRow(0);
|
|
||||||
var headerLeft = headerTableRow.insertCell(0);
|
|
||||||
var headerRight = headerTableRow.insertCell(1);
|
|
||||||
|
|
||||||
$('<span></span>').html(column.headerLabel).appendTo(headerLeft);
|
|
||||||
|
|
||||||
$(headerRight).attr("width", "1%");
|
|
||||||
$('<img src="/images/menu-dropdown.png" />').addClass("column-header-menu").appendTo(headerRight).click(function() {
|
|
||||||
self._createMenuForColumnHeader(column, index, this);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -203,45 +191,6 @@ DataTableView.prototype.render = function() {
|
|||||||
*------------------------------------------------------------
|
*------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var renderCell = function(cell, td) {
|
|
||||||
if (cell == null || cell.v == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!("r" in cell) || cell.r == null) {
|
|
||||||
$(td).html(cell.v);
|
|
||||||
} else {
|
|
||||||
var r = cell.r;
|
|
||||||
if (r.j == "new") {
|
|
||||||
$(td).html(cell.v + " (new)");
|
|
||||||
} else if (r.j == "approve" && "m" in r && r.m != null) {
|
|
||||||
var match = cell.r.m;
|
|
||||||
$('<a></a>')
|
|
||||||
.attr("href", "http://www.freebase.com/view" + match.id)
|
|
||||||
.attr("target", "_blank")
|
|
||||||
.text(match.name)
|
|
||||||
.appendTo(td);
|
|
||||||
} else {
|
|
||||||
$(td).html(cell.v);
|
|
||||||
if (self._showRecon && "c" in r && r.c.length > 0) {
|
|
||||||
var candidates = r.c;
|
|
||||||
var ul = $('<ul></ul>').appendTo(td);
|
|
||||||
|
|
||||||
for (var i = 0; i < candidates.length; i++) {
|
|
||||||
var candidate = candidates[i];
|
|
||||||
var li = $('<li></li>').appendTo(ul);
|
|
||||||
$('<a></a>')
|
|
||||||
.attr("href", "http://www.freebase.com/view" + candidate.id)
|
|
||||||
.attr("target", "_blank")
|
|
||||||
.text(candidate.name)
|
|
||||||
.appendTo(li);
|
|
||||||
$('<span></span>').addClass("recon-score").text("(" + Math.round(candidate.score) + ")").appendTo(li);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
var rows = theProject.rowModel.rows;
|
var rows = theProject.rowModel.rows;
|
||||||
for (var r = 0; r < rows.length; r++) {
|
for (var r = 0; r < rows.length; r++) {
|
||||||
var row = rows[r];
|
var row = rows[r];
|
||||||
@ -262,9 +211,9 @@ DataTableView.prototype.render = function() {
|
|||||||
var td = tr.insertCell(tr.cells.length);
|
var td = tr.insertCell(tr.cells.length);
|
||||||
if (column.collapsed) {
|
if (column.collapsed) {
|
||||||
td.innerHTML = " ";
|
td.innerHTML = " ";
|
||||||
} else if (column.cellIndex < cells.length) {
|
} else {
|
||||||
var cell = cells[column.cellIndex];
|
var cell = (column.cellIndex < cells.length) ? cells[column.cellIndex] : null;
|
||||||
renderCell(cell, td);
|
new DataTableCellUI(this, cell, r, column.cellIndex, td);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -328,345 +277,7 @@ DataTableView.prototype._createMenuForAllColumns = function(elmt) {
|
|||||||
], elmt);
|
], elmt);
|
||||||
};
|
};
|
||||||
|
|
||||||
DataTableView.prototype._createMenuForColumnHeader = function(column, index, elmt) {
|
DataTableView.prototype.createUpdateFunction = function(onBefore) {
|
||||||
self = this;
|
|
||||||
MenuSystem.createAndShowStandardMenu([
|
|
||||||
{
|
|
||||||
label: "Edit",
|
|
||||||
submenu: [
|
|
||||||
{ "heading" : "Cell Content Transformations" },
|
|
||||||
{
|
|
||||||
label: "To Titlecase",
|
|
||||||
click: function() { self._doTextTransform(column, "toTitlecase(value)"); }
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "To Uppercase",
|
|
||||||
click: function() { self._doTextTransform(column, "toUppercase(value)"); }
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "To Lowercase",
|
|
||||||
click: function() { self._doTextTransform(column, "toLowercase(value)"); }
|
|
||||||
},
|
|
||||||
{},
|
|
||||||
{
|
|
||||||
label: "Custom Expression ...",
|
|
||||||
click: function() { self._doTextTransformPrompt(column); }
|
|
||||||
},
|
|
||||||
{ "heading" : "Column Operations" },
|
|
||||||
{
|
|
||||||
label: "Add Column Based on This Column ...",
|
|
||||||
click: function() { self._doAddColumn(column, index, "value"); }
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Remove This Column",
|
|
||||||
click: function() { self._doRemoveColumn(column, index); }
|
|
||||||
},
|
|
||||||
{ "heading" : "Advanced Transformations" },
|
|
||||||
{
|
|
||||||
label: "Split Multi-Value Cells ...",
|
|
||||||
click: function() { self._doSplitMultiValueCells(column); }
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Join Multi-Value Cells ...",
|
|
||||||
click: function() { self._doJoinMultiValueCells(column); }
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Filter",
|
|
||||||
tooltip: "Filter rows by this column's cell content or characteristics",
|
|
||||||
submenu: [
|
|
||||||
{
|
|
||||||
label: "Text Facet",
|
|
||||||
click: function() {
|
|
||||||
ui.browsingEngine.addFacet(
|
|
||||||
"list",
|
|
||||||
{
|
|
||||||
"name" : column.headerLabel,
|
|
||||||
"cellIndex" : column.cellIndex,
|
|
||||||
"expression" : "value"
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Custom Text Facet ...",
|
|
||||||
click: function() { self._doFilterByExpressionPrompt(column, "value", "list"); }
|
|
||||||
},
|
|
||||||
{},
|
|
||||||
{
|
|
||||||
label: "Numeric Facet",
|
|
||||||
click: function() {
|
|
||||||
ui.browsingEngine.addFacet(
|
|
||||||
"range",
|
|
||||||
{
|
|
||||||
"name" : column.headerLabel,
|
|
||||||
"cellIndex" : column.cellIndex,
|
|
||||||
"expression" : "value",
|
|
||||||
"mode" : "range",
|
|
||||||
"min" : 0,
|
|
||||||
"max" : 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Custom Numeric Facet ...",
|
|
||||||
click: function() { self._doFilterByExpressionPrompt(column, "value", "range"); }
|
|
||||||
},
|
|
||||||
{},
|
|
||||||
{
|
|
||||||
label: "Text Search",
|
|
||||||
click: function() {
|
|
||||||
ui.browsingEngine.addFacet(
|
|
||||||
"text",
|
|
||||||
{
|
|
||||||
"name" : column.headerLabel,
|
|
||||||
"cellIndex" : column.cellIndex,
|
|
||||||
"mode" : "text",
|
|
||||||
"caseSensitive" : false
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Regular Expression Search",
|
|
||||||
click: function() {
|
|
||||||
ui.browsingEngine.addFacet(
|
|
||||||
"text",
|
|
||||||
{
|
|
||||||
"name" : column.headerLabel + " (regex)",
|
|
||||||
"cellIndex" : column.cellIndex,
|
|
||||||
"mode" : "regex",
|
|
||||||
"caseSensitive" : true
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "View",
|
|
||||||
tooltip: "Collapse/expand columns to make viewing the data more convenient",
|
|
||||||
submenu: [
|
|
||||||
{
|
|
||||||
label: "Collapse This Column",
|
|
||||||
click: function() {
|
|
||||||
theProject.columnModel.columns[index].collapsed = true;
|
|
||||||
self.render();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Collapse All Other Columns",
|
|
||||||
click: function() {
|
|
||||||
for (var i = 0; i < theProject.columnModel.columns.length; i++) {
|
|
||||||
if (i != index) {
|
|
||||||
theProject.columnModel.columns[i].collapsed = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
self.render();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Collapse All Columns To Right",
|
|
||||||
click: function() {
|
|
||||||
for (var i = index + 1; i < theProject.columnModel.columns.length; i++) {
|
|
||||||
theProject.columnModel.columns[i].collapsed = true;
|
|
||||||
}
|
|
||||||
self.render();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{},
|
|
||||||
{
|
|
||||||
label: "Reconcile",
|
|
||||||
tooltip: "Match this column's cells to topics on Freebase",
|
|
||||||
submenu: [
|
|
||||||
{
|
|
||||||
label: "Start Reconciling ...",
|
|
||||||
tooltip: "Reconcile text in this column with topics on Freebase",
|
|
||||||
click: function() {
|
|
||||||
new ReconDialog(index);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{},
|
|
||||||
{
|
|
||||||
label: "Approve Best Candidates",
|
|
||||||
tooltip: "Approve best reconciliaton candidate per cell in this column for all current filtered rows",
|
|
||||||
click: function() {
|
|
||||||
self._doApproveBestCandidates(column);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Approve As New Topics",
|
|
||||||
tooltip: "Set to create new topics for cells in this column for all current filtered rows",
|
|
||||||
click: function() {
|
|
||||||
self._doApproveNewTopics(column);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Discard Reconciliation Results",
|
|
||||||
tooltip: "Discard reconciliaton results in this column for all current filtered rows",
|
|
||||||
click: function() {
|
|
||||||
self._doDiscardReconResults(column);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Reconcile Filter",
|
|
||||||
tooltip: "Match this column's cells to topics on Freebase",
|
|
||||||
submenu: [
|
|
||||||
{
|
|
||||||
label: "By Judgment",
|
|
||||||
click: function() {
|
|
||||||
ui.browsingEngine.addFacet(
|
|
||||||
"list",
|
|
||||||
{
|
|
||||||
"name" : column.headerLabel + ": judgment",
|
|
||||||
"cellIndex" : column.cellIndex,
|
|
||||||
"expression" : "cell.recon.judgment"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"scroll" : false
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{},
|
|
||||||
{
|
|
||||||
label: "Best Candidate's Relevance Score",
|
|
||||||
click: function() {
|
|
||||||
ui.browsingEngine.addFacet(
|
|
||||||
"range",
|
|
||||||
{
|
|
||||||
"name" : column.headerLabel + ": best candidate's relevance score",
|
|
||||||
"cellIndex" : column.cellIndex,
|
|
||||||
"expression" : "cell.recon.best.score",
|
|
||||||
"mode" : "range",
|
|
||||||
"min" : 0,
|
|
||||||
"max" : 200
|
|
||||||
},
|
|
||||||
{
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Best Candidate's Type Match",
|
|
||||||
click: function() {
|
|
||||||
ui.browsingEngine.addFacet(
|
|
||||||
"list",
|
|
||||||
{
|
|
||||||
"name" : column.headerLabel + ": best candidate's type match",
|
|
||||||
"cellIndex" : column.cellIndex,
|
|
||||||
"expression" : "cell.recon.features.typeMatch"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"scroll" : false
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Best Candidate's Name Match",
|
|
||||||
click: function() {
|
|
||||||
ui.browsingEngine.addFacet(
|
|
||||||
"list",
|
|
||||||
{
|
|
||||||
"name" : column.headerLabel + ": best candidate's name match",
|
|
||||||
"cellIndex" : column.cellIndex,
|
|
||||||
"expression" : "cell.recon.features.nameMatch"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"scroll" : false
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{},
|
|
||||||
{
|
|
||||||
label: "Best Candidate's Name Edit Distance",
|
|
||||||
click: function() {
|
|
||||||
ui.browsingEngine.addFacet(
|
|
||||||
"range",
|
|
||||||
{
|
|
||||||
"name" : column.headerLabel + ": best candidate's name edit distance",
|
|
||||||
"cellIndex" : column.cellIndex,
|
|
||||||
"expression" : "cell.recon.features.nameLevenshtein",
|
|
||||||
"mode" : "range",
|
|
||||||
"min" : 0,
|
|
||||||
"max" : 1,
|
|
||||||
"step" : 0.1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Best Candidate's Name Word Similarity",
|
|
||||||
click: function() {
|
|
||||||
ui.browsingEngine.addFacet(
|
|
||||||
"range",
|
|
||||||
{
|
|
||||||
"name" : column.headerLabel + ": best candidate's name word similarity",
|
|
||||||
"cellIndex" : column.cellIndex,
|
|
||||||
"expression" : "cell.recon.features.nameWordDistance",
|
|
||||||
"mode" : "range",
|
|
||||||
"min" : 0,
|
|
||||||
"max" : 1,
|
|
||||||
"step" : 0.1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{},
|
|
||||||
{
|
|
||||||
label: "Best Candidate's Types",
|
|
||||||
click: function() {
|
|
||||||
ui.browsingEngine.addFacet(
|
|
||||||
"list",
|
|
||||||
{
|
|
||||||
"name" : column.headerLabel + ": best candidate's types",
|
|
||||||
"cellIndex" : column.cellIndex,
|
|
||||||
"expression" : "cell.recon.best.type"
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
], elmt, { width: "120px", horizontal: false });
|
|
||||||
};
|
|
||||||
|
|
||||||
DataTableView.prototype._doFilterByExpressionPrompt = function(column, expression, type) {
|
|
||||||
var self = this;
|
|
||||||
DataTableView.promptExpressionOnVisibleRows(
|
|
||||||
column,
|
|
||||||
"Custom Filter on " + column.headerLabel,
|
|
||||||
expression,
|
|
||||||
function(expression) {
|
|
||||||
var config = {
|
|
||||||
"name" : column.headerLabel + ": " + expression,
|
|
||||||
"cellIndex" : column.cellIndex,
|
|
||||||
"expression" : expression
|
|
||||||
};
|
|
||||||
if (type == "range") {
|
|
||||||
config.mode = "range";
|
|
||||||
}
|
|
||||||
|
|
||||||
ui.browsingEngine.addFacet(type, config);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
DataTableView.prototype._createUpdateFunction = function(onBefore) {
|
|
||||||
var self = this;
|
var self = this;
|
||||||
return function(data) {
|
return function(data) {
|
||||||
if (data.code == "ok") {
|
if (data.code == "ok") {
|
||||||
@ -688,35 +299,16 @@ DataTableView.prototype._createUpdateFunction = function(onBefore) {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
DataTableView.prototype._doPostThenUpdate = function(command, params, updateColumnModel) {
|
DataTableView.prototype.doPostThenUpdate = function(command, params, updateColumnModel) {
|
||||||
params.project = theProject.id;
|
params.project = theProject.id;
|
||||||
$.post(
|
$.post(
|
||||||
"/command/" + command + "?" + $.param(params),
|
"/command/" + command + "?" + $.param(params),
|
||||||
{ engine: JSON.stringify(ui.browsingEngine.getJSON()) },
|
{ engine: JSON.stringify(ui.browsingEngine.getJSON()) },
|
||||||
this._createUpdateFunction(updateColumnModel ? reinitializeProjectData : undefined),
|
this.createUpdateFunction(updateColumnModel ? reinitializeProjectData : undefined),
|
||||||
"json"
|
"json"
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
DataTableView.prototype._doTextTransform = function(column, expression) {
|
|
||||||
this._doPostThenUpdate(
|
|
||||||
"do-text-transform",
|
|
||||||
{ cell: column.cellIndex, expression: expression }
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
DataTableView.prototype._doTextTransformPrompt = function(column) {
|
|
||||||
var self = this;
|
|
||||||
DataTableView.promptExpressionOnVisibleRows(
|
|
||||||
column,
|
|
||||||
"Custom Transform on " + column.headerLabel,
|
|
||||||
"value",
|
|
||||||
function(expression) {
|
|
||||||
self._doTextTransform(column, expression);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
DataTableView.promptExpressionOnVisibleRows = function(column, title, expression, onDone) {
|
DataTableView.promptExpressionOnVisibleRows = function(column, title, expression, onDone) {
|
||||||
var rowIndices = [];
|
var rowIndices = [];
|
||||||
var values = [];
|
var values = [];
|
||||||
@ -748,84 +340,4 @@ DataTableView.promptExpressionOnVisibleRows = function(column, title, expression
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
DataTableView.prototype._doDiscardReconResults = function(column) {
|
|
||||||
this._doPostThenUpdate(
|
|
||||||
"discard-reconcile",
|
|
||||||
{ cell: column.cellIndex }
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
DataTableView.prototype._doApproveBestCandidates = function(column) {
|
|
||||||
this._doPostThenUpdate(
|
|
||||||
"approve-reconcile",
|
|
||||||
{ cell: column.cellIndex }
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
DataTableView.prototype._doApproveNewTopics = function(column) {
|
|
||||||
this._doPostThenUpdate(
|
|
||||||
"approve-new-reconcile",
|
|
||||||
{ cell: column.cellIndex }
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
DataTableView.prototype._doAddColumn = function(column, index, initialExpression) {
|
|
||||||
var self = this;
|
|
||||||
DataTableView.promptExpressionOnVisibleRows(
|
|
||||||
column,
|
|
||||||
"Add Column Based on Column " + column.headerLabel,
|
|
||||||
initialExpression,
|
|
||||||
function(expression) {
|
|
||||||
var headerLabel = window.prompt("Enter header label for new column:");
|
|
||||||
if (headerLabel != null) {
|
|
||||||
self._doPostThenUpdate(
|
|
||||||
"add-column",
|
|
||||||
{
|
|
||||||
baseCellIndex: column.cellIndex,
|
|
||||||
expression: expression,
|
|
||||||
headerLabel: headerLabel,
|
|
||||||
columnInsertIndex: index + 1
|
|
||||||
},
|
|
||||||
true
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
DataTableView.prototype._doRemoveColumn = function(column, index) {
|
|
||||||
this._doPostThenUpdate(
|
|
||||||
"remove-column",
|
|
||||||
{ columnRemovalIndex: index },
|
|
||||||
true
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
DataTableView.prototype._doJoinMultiValueCells = function(column) {
|
|
||||||
var separator = window.prompt("Enter separator to use between values", ", ");
|
|
||||||
if (separator != null) {
|
|
||||||
this._doPostThenUpdate(
|
|
||||||
"join-multi-value-cells",
|
|
||||||
{
|
|
||||||
cellIndex: column.cellIndex,
|
|
||||||
keyCellIndex: theProject.columnModel.keyCellIndex,
|
|
||||||
separator: separator
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
DataTableView.prototype._doSplitMultiValueCells = function(column) {
|
|
||||||
var separator = window.prompt("What separator currently separates the values?", ", ");
|
|
||||||
if (separator != null) {
|
|
||||||
this._doPostThenUpdate(
|
|
||||||
"split-multi-value-cells",
|
|
||||||
{
|
|
||||||
cellIndex: column.cellIndex,
|
|
||||||
keyCellIndex: theProject.columnModel.keyCellIndex,
|
|
||||||
separator: separator,
|
|
||||||
mode: "plain"
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
Loading…
Reference in New Issue
Block a user