diff --git a/src/main/java/com/metaweb/gridworks/browsing/facets/ExpressionNominalRowGrouper.java b/src/main/java/com/metaweb/gridworks/browsing/facets/ExpressionNominalRowGrouper.java index 0a8469e4c..abf687a6d 100644 --- a/src/main/java/com/metaweb/gridworks/browsing/facets/ExpressionNominalRowGrouper.java +++ b/src/main/java/com/metaweb/gridworks/browsing/facets/ExpressionNominalRowGrouper.java @@ -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); diff --git a/src/main/java/com/metaweb/gridworks/browsing/facets/ListFacet.java b/src/main/java/com/metaweb/gridworks/browsing/facets/ListFacet.java index b46c29373..ced648ae3 100644 --- a/src/main/java/com/metaweb/gridworks/browsing/facets/ListFacet.java +++ b/src/main/java/com/metaweb/gridworks/browsing/facets/ListFacet.java @@ -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(); diff --git a/src/main/java/com/metaweb/gridworks/browsing/filters/ExpressionEqualRowFilter.java b/src/main/java/com/metaweb/gridworks/browsing/filters/ExpressionEqualRowFilter.java index e9585c128..45224b9ed 100644 --- a/src/main/java/com/metaweb/gridworks/browsing/filters/ExpressionEqualRowFilter.java +++ b/src/main/java/com/metaweb/gridworks/browsing/filters/ExpressionEqualRowFilter.java @@ -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); diff --git a/src/main/webapp/scripts/project.js b/src/main/webapp/scripts/project.js index 049ac904c..395de433c 100644 --- a/src/main/webapp/scripts/project.js +++ b/src/main/webapp/scripts/project.js @@ -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); }); diff --git a/src/main/webapp/scripts/views/data-table-view.js b/src/main/webapp/scripts/views/data-table-view.js index b79302e0d..76dd54949 100644 --- a/src/main/webapp/scripts/views/data-table-view.js +++ b/src/main/webapp/scripts/views/data-table-view.js @@ -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) {