Added Fill Down and Blank Down commands.

git-svn-id: http://google-refine.googlecode.com/svn/trunk@1140 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
David Huynh 2010-08-06 20:33:28 +00:00
parent 3bda9d035d
commit a8ee9b9e08
6 changed files with 97 additions and 9 deletions

View File

@ -6,18 +6,23 @@ Major Changes:
- Support for QA on data loads into Freebase.
Features:
- New commands: Transpose Cells in Columns into Rows
- New GEL functions: smartSplit
- New GEL controls: forEachIndex, forRange, filter
- New GEL parameters:
- preserveAllTokens on split function
- New exporters: to RDF (as extension)
- In CSV and TSV importers, added support for ignoring quotation marks
- Regexp groups capturing GEL function
- New commands:
- Fill Down
- Blank Down
- Transpose Cells in Columns into Rows
- GEL:
- New functions: smartSplit
- New controls: forEachIndex, forRange, filter
- New parameters:
- preserveAllTokens on split function
- Regexp groups capturing GEL function
- Importers
- New: RDF exporter (as extension)
- CSV and TSV importers: added support for ignoring quotation marks
- Added support for creating a project by pointing to a data file URL.
- Text facet's choice count limit is now configurable through preference page
- Select All and Unselect All buttons in History Extract dialog
- Schema skeleton: support for multiple cells per cell-as nodes, and for conditional links
- Added support for creating a project by pointing to a data file URL.
Fixes:
- TSV/CSV exporter bug: Gridworks crashed when there were empty cells.

View File

@ -71,6 +71,8 @@ public class GridworksServlet extends Butterfly {
{"mass-edit", "com.google.gridworks.commands.cell.MassEditCommand"},
{"join-multi-value-cells", "com.google.gridworks.commands.cell.JoinMultiValueCellsCommand"},
{"split-multi-value-cells", "com.google.gridworks.commands.cell.SplitMultiValueCellsCommand"},
{"fill-down", "com.google.gridworks.commands.cell.FillDownCommand"},
{"blank-down", "com.google.gridworks.commands.cell.BlankDownCommand"},
{"transpose-columns-into-rows", "com.google.gridworks.commands.cell.TransposeColumnsIntoRowsCommand"},
{"add-column", "com.google.gridworks.commands.column.AddColumnCommand"},

View File

@ -0,0 +1,24 @@
package com.google.gridworks.commands.cell;
import javax.servlet.http.HttpServletRequest;
import org.json.JSONObject;
import com.google.gridworks.commands.EngineDependentCommand;
import com.google.gridworks.model.AbstractOperation;
import com.google.gridworks.model.Project;
import com.google.gridworks.operations.cell.BlankDownOperation;
public class BlankDownCommand extends EngineDependentCommand {
@Override
protected AbstractOperation createOperation(Project project,
HttpServletRequest request, JSONObject engineConfig) throws Exception {
String columnName = request.getParameter("columnName");
return new BlankDownOperation(
engineConfig,
columnName
);
}
}

View File

@ -0,0 +1,24 @@
package com.google.gridworks.commands.cell;
import javax.servlet.http.HttpServletRequest;
import org.json.JSONObject;
import com.google.gridworks.commands.EngineDependentCommand;
import com.google.gridworks.model.AbstractOperation;
import com.google.gridworks.model.Project;
import com.google.gridworks.operations.cell.FillDownOperation;
public class FillDownCommand extends EngineDependentCommand {
@Override
protected AbstractOperation createOperation(Project project,
HttpServletRequest request, JSONObject engineConfig) throws Exception {
String columnName = request.getParameter("columnName");
return new FillDownOperation(
engineConfig,
columnName
);
}
}

View File

@ -8,6 +8,7 @@ import org.json.JSONObject;
import com.google.gridworks.model.AbstractOperation;
import com.google.gridworks.model.Project;
import com.google.gridworks.operations.cell.FillDownOperation;
import com.google.gridworks.operations.cell.MassEditOperation;
import com.google.gridworks.operations.cell.MultiValuedCellJoinOperation;
import com.google.gridworks.operations.cell.MultiValuedCellSplitOperation;
@ -50,6 +51,7 @@ public abstract class OperationRegistry {
register("multivalued-cell-join", MultiValuedCellJoinOperation.class);
register("multivalued-cell-split", MultiValuedCellSplitOperation.class);
register("fill-down", FillDownOperation.class);
register("transpose-columns-into-rows", TransposeColumnsIntoRowsOperation.class);
register("column-addition", ColumnAdditionOperation.class);

View File

@ -279,6 +279,15 @@ DataTableColumnHeaderUI.prototype._createMenuForColumnHeader = function(elmt) {
]
},
{},
{
label: "Fill Down",
click: function() { self._doFillDown(); }
},
{
label: "Blank Down",
click: function() { self._doBlankDown(); }
},
{},
{
label: "Split Multi-Valued Cells ...",
click: function() { self._doSplitMultiValueCells(); }
@ -925,6 +934,28 @@ DataTableColumnHeaderUI.prototype._doRenameColumn = function() {
}
};
DataTableColumnHeaderUI.prototype._doFillDown = function() {
Gridworks.postProcess(
"fill-down",
{
columnName: this._column.name
},
null,
{ modelsChanged: true }
);
};
DataTableColumnHeaderUI.prototype._doBlankDown = function() {
Gridworks.postProcess(
"blank-down",
{
columnName: this._column.name
},
null,
{ modelsChanged: true }
);
};
DataTableColumnHeaderUI.prototype._doJoinMultiValueCells = function() {
var separator = window.prompt("Enter separator to use between values", ", ");
if (separator !== null) {