Re-organized popup menus for row operations. Added filter row.starred.

Disabled rendering of key column and column groups for now.

git-svn-id: http://google-refine.googlecode.com/svn/trunk@216 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
David Huynh 2010-03-05 22:31:47 +00:00
parent fe78fb8e30
commit 589b9cd936
5 changed files with 68 additions and 33 deletions

View File

@ -26,7 +26,7 @@ public class ExpressionNominalRowGrouper implements RowVisitor {
}
public boolean visit(Project project, int rowIndex, Row row, boolean contextual) {
Cell cell = row.getCell(_cellIndex);
Cell cell = _cellIndex < 0 ? null : row.getCell(_cellIndex);
Properties bindings = ExpressionUtils.createBindings(project);
ExpressionUtils.bind(bindings, row, rowIndex, cell);

View File

@ -72,7 +72,12 @@ public class ListFacet implements Facet {
_name = o.getString("name");
_expression = o.getString("expression");
_columnName = o.getString("columnName");
_cellIndex = project.columnModel.getColumnByName(_columnName).getCellIndex();
if (_columnName.length() > 0) {
_cellIndex = project.columnModel.getColumnByName(_columnName).getCellIndex();
} else {
_cellIndex = -1;
}
_eval = MetaParser.parse(_expression);
_selection.clear();

View File

@ -9,9 +9,9 @@ import com.metaweb.gridworks.model.Project;
import com.metaweb.gridworks.model.Row;
public class ExpressionEqualRowFilter implements RowFilter {
final protected Evaluable _evaluable;
final protected Evaluable _evaluable;
final protected int _cellIndex;
final protected Object[] _matches;
final protected Object[] _matches;
final protected boolean _selectBlank;
final protected boolean _selectError;
@ -24,7 +24,8 @@ public class ExpressionEqualRowFilter implements RowFilter {
}
public boolean filterRow(Project project, int rowIndex, Row row) {
Cell cell = row.getCell(_cellIndex);
Cell cell = _cellIndex < 0 ? null : row.getCell(_cellIndex);
Properties bindings = ExpressionUtils.createBindings(project);
ExpressionUtils.bind(bindings, row, rowIndex, cell);

View File

@ -112,7 +112,7 @@ Gridworks.createUpdateFunction = function(options, onFinallyDone) {
if (options["everythingChanged"] || options["modelsChanged"] || options["columnStatsChanged"]) {
pushFunction(Gridworks.reinitializeProjectData);
}
if (options["everythingChanged"] || options["modelsChanged"] || options["rowsChanged"] || options["cellsChanged"] || options["engineChanged"]) {
if (options["everythingChanged"] || options["modelsChanged"] || options["rowsChanged"] || options["rowMetadataChanged"] || options["cellsChanged"] || options["engineChanged"]) {
pushFunction(function(onDone) {
ui.dataTableView.update(onDone);
});

View File

@ -154,10 +154,12 @@ DataTableView.prototype.render = function() {
renderColumnGroups(nextLayer, []);
}
};
/*
renderColumnGroups(
columnGroups,
[ theProject.columnModel.keyCellIndex ]
);
*/
/*------------------------------------------------------------
* Column Headers with Menus
@ -294,38 +296,65 @@ DataTableView.prototype._onClickLastPage = function(elmt, evt) {
DataTableView.prototype._createMenuForAllColumns = function(elmt) {
self = this;
MenuSystem.createAndShowStandardMenu([
{
label: "Collapse All Columns",
click: function() {
for (var i = 0; i < theProject.columnModel.columns.length; i++) {
theProject.columnModel.columns[i].collapsed = true;
{ label: "Edit",
submenu: [
{
label: "Star Rows",
click: function() {
Gridworks.postProcess("annotate-rows", { "starred" : "true" }, null, { rowMetadataChanged: true });
}
},
{
label: "Unstar Rows",
click: function() {
Gridworks.postProcess("annotate-rows", { "starred" : "false" }, null, { rowMetadataChanged: true });
}
}
self.render();
}
]
},
{
label: "Expand All Columns",
click: function() {
for (var i = 0; i < theProject.columnModel.columns.length; i++) {
theProject.columnModel.columns[i].collapsed = false;
{ label: "Filter",
submenu: [
{
label: "By Star",
click: function() {
ui.browsingEngine.addFacet(
"list",
{
"name" : "Starred Rows",
"columnName" : "",
"expression" : "row.starred"
},
{
"scroll" : false
}
);
}
}
self.render();
}
]
},
{},
{
label: "Star Rows",
click: function() {
Gridworks.postProcess("annotate-rows", { "starred" : "true" }, null, { rowMetadataChanged: true });
}
},
{
label: "Unstar Rows",
click: function() {
Gridworks.postProcess("annotate-rows", { "starred" : "false" }, null, { rowMetadataChanged: true });
}
{ label: "View",
submenu: [
{
label: "Collapse All Columns",
click: function() {
for (var i = 0; i < theProject.columnModel.columns.length; i++) {
theProject.columnModel.columns[i].collapsed = true;
}
self.render();
}
},
{
label: "Expand All Columns",
click: function() {
for (var i = 0; i < theProject.columnModel.columns.length; i++) {
theProject.columnModel.columns[i].collapsed = false;
}
self.render();
}
}
]
}
], elmt);
], elmt, { width: "80px", horizontal: false });
};
DataTableView.sampleVisibleRows = function(column) {