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 b630ac8c2..ccc7cfdfa 100644 --- a/src/main/java/com/metaweb/gridworks/browsing/facets/ExpressionNominalRowGrouper.java +++ b/src/main/java/com/metaweb/gridworks/browsing/facets/ExpressionNominalRowGrouper.java @@ -25,23 +25,20 @@ public class ExpressionNominalRowGrouper implements RowVisitor { @Override public boolean visit(Project project, int rowIndex, Row row, boolean contextual) { - if (_cellIndex < row.cells.size()) { - Cell cell = row.cells.get(_cellIndex); - if (cell != null) { - Properties bindings = ExpressionUtils.createBindings(project); - ExpressionUtils.bind(bindings, row, cell); - - Object value = _evaluable.evaluate(bindings); - if (value != null) { - if (value.getClass().isArray()) { - Object[] a = (Object[]) value; - for (Object v : a) { - processValue(v); - } - } else { - processValue(value); - } + Cell cell = row.getCell(_cellIndex); + + Properties bindings = ExpressionUtils.createBindings(project); + ExpressionUtils.bind(bindings, row, cell); + + Object value = _evaluable.evaluate(bindings); + if (value != null) { + if (value.getClass().isArray()) { + Object[] a = (Object[]) value; + for (Object v : a) { + processValue(v); } + } else { + processValue(value); } } return false; diff --git a/src/main/java/com/metaweb/gridworks/browsing/facets/ExpressionNumericRowBinner.java b/src/main/java/com/metaweb/gridworks/browsing/facets/ExpressionNumericRowBinner.java index 8e63fa29a..50ba7b745 100644 --- a/src/main/java/com/metaweb/gridworks/browsing/facets/ExpressionNumericRowBinner.java +++ b/src/main/java/com/metaweb/gridworks/browsing/facets/ExpressionNumericRowBinner.java @@ -25,23 +25,20 @@ public class ExpressionNumericRowBinner implements RowVisitor { @Override public boolean visit(Project project, int rowIndex, Row row, boolean contextual) { - if (_cellIndex < row.cells.size()) { - Cell cell = row.cells.get(_cellIndex); - if (cell != null) { - Properties bindings = ExpressionUtils.createBindings(project); - ExpressionUtils.bind(bindings, row, cell); - - Object value = _evaluable.evaluate(bindings); - if (value != null) { - if (value.getClass().isArray()) { - Object[] a = (Object[]) value; - for (Object v : a) { - processValue(v); - } - } else { - processValue(value); - } + Cell cell = row.getCell(_cellIndex); + + Properties bindings = ExpressionUtils.createBindings(project); + ExpressionUtils.bind(bindings, row, cell); + + Object value = _evaluable.evaluate(bindings); + if (value != null) { + if (value.getClass().isArray()) { + Object[] a = (Object[]) value; + for (Object v : a) { + processValue(v); } + } else { + processValue(value); } } return false; diff --git a/src/main/java/com/metaweb/gridworks/browsing/facets/NumericBinIndex.java b/src/main/java/com/metaweb/gridworks/browsing/facets/NumericBinIndex.java index 416ec0500..b34d3b435 100644 --- a/src/main/java/com/metaweb/gridworks/browsing/facets/NumericBinIndex.java +++ b/src/main/java/com/metaweb/gridworks/browsing/facets/NumericBinIndex.java @@ -25,25 +25,21 @@ public class NumericBinIndex { List allValues = new ArrayList(); for (int i = 0; i < project.rows.size(); i++) { Row row = project.rows.get(i); + Cell cell = row.getCell(cellIndex); + + ExpressionUtils.bind(bindings, row, cell); - if (cellIndex < row.cells.size()) { - Cell cell = row.cells.get(cellIndex); - if (cell != null) { - ExpressionUtils.bind(bindings, row, cell); - - Object value = eval.evaluate(bindings); - if (value != null) { - if (value.getClass().isArray()) { - Object[] a = (Object[]) value; - for (Object v : a) { - if (v instanceof Number) { - processValue(((Number) v).doubleValue(), allValues); - } - } - } else if (value instanceof Number) { - processValue(((Number) value).doubleValue(), allValues); + Object value = eval.evaluate(bindings); + if (value != null) { + if (value.getClass().isArray()) { + Object[] a = (Object[]) value; + for (Object v : a) { + if (v instanceof Number) { + processValue(((Number) v).doubleValue(), allValues); } } + } else if (value instanceof Number) { + processValue(((Number) value).doubleValue(), allValues); } } } 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 7245072e3..a60b714f5 100644 --- a/src/main/java/com/metaweb/gridworks/browsing/filters/ExpressionEqualRowFilter.java +++ b/src/main/java/com/metaweb/gridworks/browsing/filters/ExpressionEqualRowFilter.java @@ -21,31 +21,27 @@ public class ExpressionEqualRowFilter implements RowFilter { @Override public boolean filterRow(Project project, int rowIndex, Row row) { - if (_cellIndex < row.cells.size()) { - Cell cell = row.cells.get(_cellIndex); - if (cell != null) { - Properties bindings = ExpressionUtils.createBindings(project); - ExpressionUtils.bind(bindings, row, cell); - - Object value = _evaluable.evaluate(bindings); - if (value != null) { - if (value.getClass().isArray()) { - Object[] a = (Object[]) value; - for (Object v : a) { - for (Object match : _matches) { - if (match.equals(v)) { - return true; - } - } - } - } else { - for (Object match : _matches) { - if (match.equals(value)) { - return true; - } + Cell cell = row.getCell(_cellIndex); + Properties bindings = ExpressionUtils.createBindings(project); + ExpressionUtils.bind(bindings, row, cell); + + Object value = _evaluable.evaluate(bindings); + if (value != null) { + if (value.getClass().isArray()) { + Object[] a = (Object[]) value; + for (Object v : a) { + for (Object match : _matches) { + if (match.equals(v)) { + return true; } } } + } else { + for (Object match : _matches) { + if (match.equals(value)) { + return true; + } + } } } return false; diff --git a/src/main/java/com/metaweb/gridworks/browsing/filters/ExpressionNumberComparisonRowFilter.java b/src/main/java/com/metaweb/gridworks/browsing/filters/ExpressionNumberComparisonRowFilter.java index 2040b6bf6..c2c70e8b3 100644 --- a/src/main/java/com/metaweb/gridworks/browsing/filters/ExpressionNumberComparisonRowFilter.java +++ b/src/main/java/com/metaweb/gridworks/browsing/filters/ExpressionNumberComparisonRowFilter.java @@ -19,27 +19,24 @@ abstract public class ExpressionNumberComparisonRowFilter implements RowFilter { @Override public boolean filterRow(Project project, int rowIndex, Row row) { - if (_cellIndex < row.cells.size()) { - Cell cell = row.cells.get(_cellIndex); - if (cell != null) { - Properties bindings = ExpressionUtils.createBindings(project); - ExpressionUtils.bind(bindings, row, cell); - - Object value = _evaluable.evaluate(bindings); - if (value != null) { - if (value.getClass().isArray()) { - Object[] a = (Object[]) value; - for (Object v : a) { - if (v instanceof Number && checkValue(((Number) v).doubleValue())) { - return true; - } - } - } else { - if (value instanceof Number && checkValue(((Number) value).doubleValue())) { - return true; - } + Cell cell = row.getCell(_cellIndex); + + Properties bindings = ExpressionUtils.createBindings(project); + ExpressionUtils.bind(bindings, row, cell); + + Object value = _evaluable.evaluate(bindings); + if (value != null) { + if (value.getClass().isArray()) { + Object[] a = (Object[]) value; + for (Object v : a) { + if (v instanceof Number && checkValue(((Number) v).doubleValue())) { + return true; } } + } else { + if (value instanceof Number && checkValue(((Number) value).doubleValue())) { + return true; + } } } return false; diff --git a/src/main/java/com/metaweb/gridworks/browsing/filters/ExpressionStringComparisonRowFilter.java b/src/main/java/com/metaweb/gridworks/browsing/filters/ExpressionStringComparisonRowFilter.java index 8d9a98e41..849ce2c33 100644 --- a/src/main/java/com/metaweb/gridworks/browsing/filters/ExpressionStringComparisonRowFilter.java +++ b/src/main/java/com/metaweb/gridworks/browsing/filters/ExpressionStringComparisonRowFilter.java @@ -19,27 +19,23 @@ abstract public class ExpressionStringComparisonRowFilter implements RowFilter { @Override public boolean filterRow(Project project, int rowIndex, Row row) { - if (_cellIndex < row.cells.size()) { - Cell cell = row.cells.get(_cellIndex); - if (cell != null) { - Properties bindings = ExpressionUtils.createBindings(project); - ExpressionUtils.bind(bindings, row, cell); - - Object value = _evaluable.evaluate(bindings); - if (value != null) { - if (value.getClass().isArray()) { - Object[] a = (Object[]) value; - for (Object v : a) { - if (checkValue(v instanceof String ? ((String) v) : v.toString())) { - return true; - } - } - } else { - if (checkValue(value instanceof String ? ((String) value) : value.toString())) { - return true; - } + Cell cell = row.getCell(_cellIndex); + Properties bindings = ExpressionUtils.createBindings(project); + ExpressionUtils.bind(bindings, row, cell); + + Object value = _evaluable.evaluate(bindings); + if (value != null) { + if (value.getClass().isArray()) { + Object[] a = (Object[]) value; + for (Object v : a) { + if (checkValue(v instanceof String ? ((String) v) : v.toString())) { + return true; } } + } else { + if (checkValue(value instanceof String ? ((String) value) : value.toString())) { + return true; + } } } return false; diff --git a/src/main/java/com/metaweb/gridworks/commands/Command.java b/src/main/java/com/metaweb/gridworks/commands/Command.java index a6d716f96..21bbc4523 100644 --- a/src/main/java/com/metaweb/gridworks/commands/Command.java +++ b/src/main/java/com/metaweb/gridworks/commands/Command.java @@ -87,6 +87,7 @@ public abstract class Command { } protected void respondException(HttpServletResponse response, Exception e) throws IOException { + e.printStackTrace(); try { JSONObject o = new JSONObject(); o.put("code", "error"); diff --git a/src/main/java/com/metaweb/gridworks/commands/util/PreviewExpressionCommand.java b/src/main/java/com/metaweb/gridworks/commands/util/PreviewExpressionCommand.java index 5e8083a88..ca8c11bb2 100644 --- a/src/main/java/com/metaweb/gridworks/commands/util/PreviewExpressionCommand.java +++ b/src/main/java/com/metaweb/gridworks/commands/util/PreviewExpressionCommand.java @@ -57,17 +57,14 @@ public class PreviewExpressionCommand extends Command { int rowIndex = rowIndices.getInt(i); if (rowIndex >= 0 && rowIndex < project.rows.size()) { Row row = project.rows.get(rowIndex); - if (cellIndex < row.cells.size()) { - Cell cell = row.cells.get(cellIndex); - if (cell != null && cell.value != null) { - ExpressionUtils.bind(bindings, row, cell); - - try { - result = eval.evaluate(bindings); - } catch (Exception e) { - // ignore - } - } + Cell cell = row.getCell(cellIndex); + + ExpressionUtils.bind(bindings, row, cell); + + try { + result = eval.evaluate(bindings); + } catch (Exception e) { + // ignore } } diff --git a/src/main/java/com/metaweb/gridworks/expr/ExpressionUtils.java b/src/main/java/com/metaweb/gridworks/expr/ExpressionUtils.java index c103d1f13..eb1025118 100644 --- a/src/main/java/com/metaweb/gridworks/expr/ExpressionUtils.java +++ b/src/main/java/com/metaweb/gridworks/expr/ExpressionUtils.java @@ -22,8 +22,13 @@ public class ExpressionUtils { bindings.put("row", row); bindings.put("cells", row.getField("cells", bindings)); - bindings.put("cell", cell); - bindings.put("value", cell.value); + if (cell == null) { + bindings.remove("cell"); + bindings.remove("value"); + } else { + bindings.put("cell", cell); + bindings.put("value", cell.value); + } } static public boolean isBlank(Object o) { diff --git a/src/main/java/com/metaweb/gridworks/model/operations/ColumnAdditionOperation.java b/src/main/java/com/metaweb/gridworks/model/operations/ColumnAdditionOperation.java index 66dcd5899..2dd9fea68 100644 --- a/src/main/java/com/metaweb/gridworks/model/operations/ColumnAdditionOperation.java +++ b/src/main/java/com/metaweb/gridworks/model/operations/ColumnAdditionOperation.java @@ -109,16 +109,17 @@ public class ColumnAdditionOperation extends EngineDependentOperation { @Override public boolean visit(Project project, int rowIndex, Row row, boolean contextual) { - if (cellIndex < row.cells.size()) { - Cell cell = row.cells.get(cellIndex); - if (cell.value != null) { - ExpressionUtils.bind(bindings, row, cell); - - Cell newCell = new Cell(eval.evaluate(bindings), null); - - cellsAtRows.add(new CellAtRow(rowIndex, newCell)); - } - } + Cell cell = row.getCell(cellIndex); + + ExpressionUtils.bind(bindings, row, cell); + + Object v = eval.evaluate(bindings); + if (v != null) { + Cell newCell = new Cell(v, null); + + cellsAtRows.add(new CellAtRow(rowIndex, newCell)); + } + return false; } }.init(_baseCellIndex, bindings, cellsAtRows, eval); diff --git a/src/main/java/com/metaweb/gridworks/model/operations/MultiValueCellJoinOperation.java b/src/main/java/com/metaweb/gridworks/model/operations/MultiValueCellJoinOperation.java index e833e737e..65c64c930 100644 --- a/src/main/java/com/metaweb/gridworks/model/operations/MultiValueCellJoinOperation.java +++ b/src/main/java/com/metaweb/gridworks/model/operations/MultiValueCellJoinOperation.java @@ -7,6 +7,7 @@ import java.util.Properties; import org.json.JSONException; import org.json.JSONWriter; +import com.metaweb.gridworks.expr.ExpressionUtils; import com.metaweb.gridworks.history.Change; import com.metaweb.gridworks.history.HistoryEntry; import com.metaweb.gridworks.model.AbstractOperation; @@ -68,7 +69,7 @@ public class MultiValueCellJoinOperation implements AbstractOperation { StringBuffer sb = new StringBuffer(); for (int r3 = r; r3 < r2; r3++) { Object value = project.rows.get(r3).getCellValue(_cellIndex); - if (value != null) { + if (!ExpressionUtils.isBlank(value)) { if (sb.length() > 0) { sb.append(_separator); } diff --git a/src/main/java/com/metaweb/gridworks/model/operations/TextTransformOperation.java b/src/main/java/com/metaweb/gridworks/model/operations/TextTransformOperation.java index 4ae7fcf1b..577436bb6 100644 --- a/src/main/java/com/metaweb/gridworks/model/operations/TextTransformOperation.java +++ b/src/main/java/com/metaweb/gridworks/model/operations/TextTransformOperation.java @@ -63,17 +63,18 @@ public class TextTransformOperation extends EngineDependentMassCellOperation { @Override public boolean visit(Project project, int rowIndex, Row row, boolean contextual) { - if (cellIndex < row.cells.size()) { - Cell cell = row.cells.get(cellIndex); - if (cell.value != null) { - ExpressionUtils.bind(bindings, row, cell); - - Cell newCell = new Cell(eval.evaluate(bindings), cell.recon); - - CellChange cellChange = new CellChange(rowIndex, cellIndex, cell, newCell); - cellChanges.add(cellChange); - } - } + Cell cell = row.getCell(cellIndex); + + ExpressionUtils.bind(bindings, row, cell); + + Object v = eval.evaluate(bindings); + if ((cell != null && cell.value != null) || v != null) { + Cell newCell = new Cell(v, cell.recon); + + CellChange cellChange = new CellChange(rowIndex, cellIndex, cell, newCell); + cellChanges.add(cellChange); + } + return false; } }.init(_cellIndex, bindings, cellChanges, eval); diff --git a/src/main/webapp/project.html b/src/main/webapp/project.html index db88ff4c9..dc9fa050b 100644 --- a/src/main/webapp/project.html +++ b/src/main/webapp/project.html @@ -1 +1 @@ - Gridlock
Loading ...
\ No newline at end of file + Gridlock
starting up ...
\ No newline at end of file diff --git a/src/main/webapp/scripts/project.js b/src/main/webapp/scripts/project.js index de9b0afa0..a1b1ddfae 100644 --- a/src/main/webapp/scripts/project.js +++ b/src/main/webapp/scripts/project.js @@ -15,7 +15,8 @@ $(onLoad); function initializeUI() { document.title = theProject.metadata.name + " - Gridworks"; - $('').text(theProject.metadata.name).appendTo($("#title")); + $('').text(theProject.metadata.name).addClass("app-path-section").appendTo($("#path")); + $('').text(" project").appendTo($("#path")); var body = $("#body").empty(); diff --git a/src/main/webapp/scripts/project/data-table-view.js b/src/main/webapp/scripts/project/data-table-view.js index d48050100..c35df11c5 100644 --- a/src/main/webapp/scripts/project/data-table-view.js +++ b/src/main/webapp/scripts/project/data-table-view.js @@ -326,6 +326,15 @@ DataTableView.prototype._createMenuForAllColumns = function(elmt) { } }, {}, + { + label: "Automatically Align Schemas with Freebase ...", + click: function() { self._doAutoSchemaAlignment(); } + }, + { + label: "Edit Schema Alignment ...", + click: function() { } + }, + {}, { label: "Export Filtered Rows", click: function() { self._doExportRows(); } @@ -336,11 +345,51 @@ DataTableView.prototype._createMenuForAllColumns = function(elmt) { DataTableView.prototype._createMenuForColumnHeader = function(column, index, elmt) { 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: [ - { "heading" : "On Cell Content" }, { label: "Text Facet", click: function() { @@ -354,6 +403,11 @@ DataTableView.prototype._createMenuForColumnHeader = function(column, index, elm ); } }, + { + label: "Custom Text Facet ...", + click: function() { self._doFilterByExpressionPrompt(column, "value", "list"); } + }, + {}, { label: "Numeric Facet", click: function() { @@ -372,10 +426,6 @@ DataTableView.prototype._createMenuForColumnHeader = function(column, index, elm ); } }, - { - label: "Custom Text Facet ...", - click: function() { self._doFilterByExpressionPrompt(column, "value", "list"); } - }, { label: "Custom Numeric Facet ...", click: function() { self._doFilterByExpressionPrompt(column, "value", "range"); } @@ -408,8 +458,82 @@ DataTableView.prototype._createMenuForColumnHeader = function(column, index, elm } ); } + } + ] + }, + { + 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(); + } }, - { "heading" : "By Reconciliation Features" }, + { + 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() { @@ -531,116 +655,6 @@ DataTableView.prototype._createMenuForColumnHeader = function(column, index, elm } } ] - }, - { - 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: "Edit", - submenu: [ - { "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" : "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" : "Advanced Transformations" }, - { - label: "Join Multi-Value Cells ...", - click: function() { self._doJoinMultiValueCells(column); } - }, - { - label: "Split Multi-Value Cells ...", - click: function() { self._doSplitMultiValueCells(column); } - } - ] - }, - { - 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); - } - } - ] } ], elmt, { width: "120px", horizontal: false }); }; @@ -850,3 +864,7 @@ DataTableView.prototype._doExportRows = function() { document.body.removeChild(form); }; + +DataTableView.prototype._doAutoSchemaAlignment = function() { + SchemaAlignment.autoAlign(); +}; diff --git a/src/main/webapp/scripts/project/expression-preview-dialog.js b/src/main/webapp/scripts/project/expression-preview-dialog.js index f84501894..14f235b53 100644 --- a/src/main/webapp/scripts/project/expression-preview-dialog.js +++ b/src/main/webapp/scripts/project/expression-preview-dialog.js @@ -20,11 +20,12 @@ ExpressionPreviewDialog.prototype._createDialog = function(title) { var body = $('
').addClass("dialog-body").appendTo(frame); var footer = $('
').addClass("dialog-footer").appendTo(frame); - $('

').text("Expression:").appendTo(body); + var p = $('

').text("Expression: ").appendTo(body); this._input = $('').width("400px").keypress(function(){ self._scheduleUpdate(); - }).appendTo($('

').appendTo(body)); + }).appendTo(p); + this._preview = $('
').addClass("expression-preview-container").appendTo(body); $('').html("  OK  ").click(function() { @@ -40,7 +41,7 @@ ExpressionPreviewDialog.prototype._createDialog = function(title) { this._input[0].value = this._expression; this._input[0].focus(); - this._renderPreview(this._expression); + this._update(); }; ExpressionPreviewDialog.prototype._scheduleUpdate = function() { @@ -75,23 +76,34 @@ ExpressionPreviewDialog.prototype._update = function() { ExpressionPreviewDialog.prototype._renderPreview = function(expression) { var container = this._preview.empty(); - var table = $('
').appendTo(container)[0]; + var table = $('
').appendTo(container)[0]; + var tr = table.insertRow(0); - $(tr.insertCell(0)).addClass("expression-preview-heading").text("value"); - $(tr.insertCell(1)).addClass("expression-preview-heading").text(expression); + $(tr.insertCell(0)).addClass("expression-preview-heading").text("row"); + $(tr.insertCell(1)).addClass("expression-preview-heading").text("value"); + $(tr.insertCell(2)).addClass("expression-preview-heading").text(expression); + + var renderValue = function(td, v) { + if (v != null) { + td.html($.isArray(v) ? JSON.stringify(v) : v); + } else { + $('(null)').addClass("expression-preview-empty").appendTo(td); + } + }; for (var i = 0; i < this._values.length; i++) { var tr = table.insertRow(table.rows.length); - $(tr.insertCell(0)).html(this._values[i]); + $(tr.insertCell(0)).attr("width", "1%").html((this._rowIndices[i] + 1) + "."); + + renderValue($(tr.insertCell(1)), this._values[i]); + + var tdValue = $(tr.insertCell(2)); if (this._results != null) { var v = this._results[i]; - if (v != null) { - if ($.isArray(v)) { - v = JSON.stringify(v); - } - $(tr.insertCell(1)).html(v); - } + renderValue(tdValue, v); + } else { + $('(error)').addClass("expression-preview-empty").appendTo(tdValue); } } }; \ No newline at end of file diff --git a/src/main/webapp/scripts/project/history-widget.js b/src/main/webapp/scripts/project/history-widget.js index 94f554d86..09a9e2a91 100644 --- a/src/main/webapp/scripts/project/history-widget.js +++ b/src/main/webapp/scripts/project/history-widget.js @@ -19,16 +19,16 @@ HistoryWidget.prototype._render = function() { this._div.empty(); - $('

History for Undo/Redo

').appendTo(this._div); + $('

Undo/Redo History

').appendTo(this._div); var bodyDiv = $('
').addClass("history-panel-body").appendTo(this._div); - bodyDiv.mouseover(function() { - this.style.height = "300px"; - }).mouseout(function() { - this.style.height = "50px"; + bodyDiv.mouseenter(function(evt) { + $(this).addClass("history-panel-body-expanded"); + }).mouseleave(function(evt) { + $(this).removeClass("history-panel-body-expanded"); + autoscroll(); }); - var lastPast = null; var renderEntry = function(container, entry, lastDoneID, title) { var a = $('').appendTo(container); a.addClass("history-entry").html(entry.description).attr("title", title).click(function(evt) { @@ -43,11 +43,11 @@ HistoryWidget.prototype._render = function() { } else { for (var i = 0; i < this._data.past.length; i++) { var entry = this._data.past[i]; - lastPast = renderEntry(divPast, entry, i == 0 ? 0 : this._data.past[i - 1].id, "Undo to here"); + renderEntry(divPast, entry, i == 0 ? 0 : this._data.past[i - 1].id, "Undo to here"); } } - $('
').text("done upto here").addClass("history-now").appendTo(bodyDiv); + var divNow = $('
').text("done upto here").addClass("history-now").appendTo(bodyDiv); var divFuture = $('
').addClass("history-future").appendTo(bodyDiv); if (this._data.future.length == 0) { @@ -59,9 +59,10 @@ HistoryWidget.prototype._render = function() { } } - if (lastPast != null) { - bodyDiv[0].scrollTop = lastPast[0].offsetTop; - } + var autoscroll = function() { + bodyDiv[0].scrollTop = divNow[0].offsetTop + divNow[0].offsetHeight - bodyDiv[0].offsetHeight; + }; + autoscroll(); }; HistoryWidget.prototype._onClickHistoryEntry = function(evt, entry, lastDoneID) { diff --git a/src/main/webapp/scripts/project/schema-alignment.js b/src/main/webapp/scripts/project/schema-alignment.js new file mode 100644 index 000000000..b25672333 --- /dev/null +++ b/src/main/webapp/scripts/project/schema-alignment.js @@ -0,0 +1,24 @@ +var SchemaAlignment = {}; + +SchemaAlignment.autoAlign = function() { + var protograph = {}; + + var columns = theProject.columnModel.columns; + + var typedColumns = []; + var candidates = []; + + for (var c = 0; c < columns.length; c++) { + var column = columns[c]; + if ("reconConfig" in column && column.reconConfig != null) { + typedColumns.push(column); + } + candidates.push({ + status: "unbound", + index: c, + column: column + }) + } + + +}; \ No newline at end of file diff --git a/src/main/webapp/scripts/util/menu.js b/src/main/webapp/scripts/util/menu.js index 30451f000..0273a03e4 100644 --- a/src/main/webapp/scripts/util/menu.js +++ b/src/main/webapp/scripts/util/menu.js @@ -78,8 +78,13 @@ MenuSystem.createAndShowStandardMenu = function(items, elmt, options) { if ("label" in item) { var menuItem = MenuSystem.createMenuItem().appendTo(menu); if ("submenu" in item) { - menuItem.html('
' + item.label + '
'); - menuItem.mouseover(function() { + menuItem.html( + '' + + '' + + '' + + '' + ); + menuItem.mouseenter(function() { MenuSystem.dismissUntil(level); menuItem.addClass("menu-expanded"); @@ -100,7 +105,7 @@ MenuSystem.createAndShowStandardMenu = function(items, elmt, options) { if ("tooltip" in item) { menuItem.attr("title", item.tooltip); } - menuItem.mouseover(function() { + menuItem.mouseenter(function() { MenuSystem.dismissUntil(level); }); } diff --git a/src/main/webapp/styles/common.css b/src/main/webapp/styles/common.css index c0cb9aaad..c2003678e 100644 --- a/src/main/webapp/styles/common.css +++ b/src/main/webapp/styles/common.css @@ -18,8 +18,19 @@ tr, td { } #header { - padding: 10px 20px; - background: #eee; + padding: 5px 20px; + background: #666; + color: #eee; +} +#header .app-path-section { + font-weight: bold; +} +#header a.app-path-section { + text-decoration: none; + color: #eee; +} +#header a.app-path-section:hover { + text-decoration: underline; } #header h1 { @@ -45,119 +56,10 @@ a.inaction { color: #ccc; } -.menu-overlay { - background: black; - opacity: 0.3; - position: fixed; - padding: 0px; - margin: 0px; - top: 0px; - left: 0px; - width: 100%; - height: 100%; -} - -.menu-container { - position: absolute; - width: 250px; - background: white; - padding: 1px; - border: 1px solid #ddd; -} - -.menu-container hr { - height: 1px; - border: none; - border-top: 1px solid #ccc; - padding: 0px; - margin: 2px 0px; -} - -a.menu-item { - display: block; - padding: 5px 7px; - text-decoration: none; - color: black; - white-space: pre; -} - -a.menu-item:hover { - color: #44a; - background: #eee; -} - -a.menu-item.menu-expanded { - background: #ddd; -} - -a.menu-item img { +a img { border: none; } -.menu-section { - padding: 2px 7px; - background: #aaa; - color: white; - font-weight: bold; -} - -.dialog-overlay { - background: black; - opacity: 0.3; - position: fixed; - padding: 0px; - margin: 0px; - top: 0px; - left: 0px; - width: 100%; - height: 100%; -} - -.dialog-overlay2 { - position: fixed; - padding: 0px; - margin: 0px; - top: 0px; - left: 0px; - width: 100%; - height: 100%; - background: black; - opacity: 0.01; -} - -.dialog-container { - position: fixed; - padding: 0px; - margin: 0px; - left: 0px; - width: 100%; - text-align: center; -} - -.dialog-frame { - margin: 0 auto; - text-align: left; - background: white; - border: 1px solid #aaa; - padding: 2px; -} - -.dialog-header { - background: #ccc; - padding: 5px 10px; - font-weight: bold; -} - -.dialog-body { - padding: 10px; -} - -.dialog-footer { - background: #ddd; - padding: 5px 10px; - text-align: right; -} - -.dialog-footer button { - margin-left: 5px; +img { + vertical-align: middle; } \ No newline at end of file diff --git a/src/main/webapp/styles/data-table-view.css b/src/main/webapp/styles/data-table-view.css new file mode 100644 index 000000000..f2902a844 --- /dev/null +++ b/src/main/webapp/styles/data-table-view.css @@ -0,0 +1,43 @@ +.data-table-container { + border: 1px solid #ccc; + overflow-x: auto; +} + +table.data-table td { + padding: 2px 5px; +} + +table.data-table tr.odd { +} + +table.data-table tr.even { + background: #eee; +} + +table.data-table tr.contextual { + opacity: 0.2; +} + +table.data-table td.column-header { + background: #ddd; + cursor: pointer; + padding: 5px 5px; + border-bottom: 2px solid #aaa; + white-space: pre; + font-weight: bold; +} + +table.column-header-layout td { + padding: 0px; + font-weight: bold; +} + +img.column-header-menu { +} + +.viewPanel-summary { +} +.viewPanel-pagingControls { + text-align: center; + margin: 1em 0; +} diff --git a/src/main/webapp/styles/dialog.css b/src/main/webapp/styles/dialog.css new file mode 100644 index 000000000..b6d86588d --- /dev/null +++ b/src/main/webapp/styles/dialog.css @@ -0,0 +1,60 @@ +.dialog-overlay { + background: black; + opacity: 0.3; + position: fixed; + padding: 0px; + margin: 0px; + top: 0px; + left: 0px; + width: 100%; + height: 100%; +} + +.dialog-overlay2 { + position: fixed; + padding: 0px; + margin: 0px; + top: 0px; + left: 0px; + width: 100%; + height: 100%; + background: black; + opacity: 0.01; +} + +.dialog-container { + position: fixed; + padding: 0px; + margin: 0px; + left: 0px; + width: 100%; + text-align: center; +} + +.dialog-frame { + margin: 0 auto; + text-align: left; + background: white; + border: 1px solid #aaa; + padding: 2px; +} + +.dialog-header { + background: #ccc; + padding: 5px 10px; + font-weight: bold; +} + +.dialog-body { + padding: 10px; +} + +.dialog-footer { + background: #ddd; + padding: 5px 10px; + text-align: right; +} + +.dialog-footer button { + margin-left: 5px; +} \ No newline at end of file diff --git a/src/main/webapp/styles/expression-preview-dialog.css b/src/main/webapp/styles/expression-preview-dialog.css index 1b8e93669..17261a45b 100644 --- a/src/main/webapp/styles/expression-preview-dialog.css +++ b/src/main/webapp/styles/expression-preview-dialog.css @@ -15,3 +15,6 @@ td.expression-preview-heading { font-weight: bold; } +.expression-preview-empty { + color: #aaa; +} \ No newline at end of file diff --git a/src/main/webapp/styles/history.css b/src/main/webapp/styles/history.css index c1ddcb4eb..7e3113078 100644 --- a/src/main/webapp/styles/history.css +++ b/src/main/webapp/styles/history.css @@ -2,21 +2,28 @@ position: absolute; top: -1px; right: 20px; - width: 200px; + width: 250px; background: #fffee0; - border: 1px solid #ccc; + border: 1px solid #666; z-index: 10; + -moz-border-radius-bottomleft: 20px; + padding-bottom: 10px; } .history-panel h3 { margin: 0; padding: 3px; - background: #888; + background: #aaa; color: #eee; font-size: 100%; + text-align: center; } .history-panel-body { padding: 2px; height: 50px; + overflow: hidden; +} +.history-panel-body.history-panel-body-expanded { + height: 300px; overflow: auto; } .history-panel-message { diff --git a/src/main/webapp/styles/menu.css b/src/main/webapp/styles/menu.css new file mode 100644 index 000000000..d462a646e --- /dev/null +++ b/src/main/webapp/styles/menu.css @@ -0,0 +1,59 @@ +.menu-overlay { + background: black; + opacity: 0.15; + position: fixed; + padding: 0px; + margin: 0px; + top: 0px; + left: 0px; + width: 100%; + height: 100%; +} + +.menu-container { + position: absolute; + width: 250px; + background: white; + padding: 1px; + border: 1px solid #ddd; +} + +.menu-container hr { + height: 1px; + border: none; + border-top: 1px solid #ccc; + padding: 0px; + margin: 2px 0px; +} + +a.menu-item { + display: block; + padding: 5px 7px; + text-decoration: none; + color: black; + white-space: pre; +} + +a.menu-item:hover { + color: #44a; + background: #eee; +} + +a.menu-item.menu-expanded { + background: #ddd; +} + +a.menu-item img { + border: none; +} + +table.menu-item-layout td { + vertical-align: middle; +} + +.menu-section { + padding: 2px 7px; + background: #aaa; + color: white; + font-weight: bold; +} diff --git a/src/main/webapp/styles/project.css b/src/main/webapp/styles/project.css index 6f10a953f..1ad125616 100644 --- a/src/main/webapp/styles/project.css +++ b/src/main/webapp/styles/project.css @@ -1,44 +1,8 @@ -.data-table-container { - border: 1px solid #ccc; - overflow-x: auto; -} - -table.data-table td { - padding: 2px 5px; -} - -table.data-table tr.odd { -} - -table.data-table tr.even { - background: #eee; -} - -table.data-table tr.contextual { - opacity: 0.2; -} - -table.data-table td.column-header { - background: #ddd; - cursor: pointer; - padding: 5px 5px; - border-bottom: 2px solid #aaa; - white-space: pre; - font-weight: bold; -} - -table.column-header-layout td { - padding: 0px; - vertical-align: middle; - font-weight: bold; -} - -img.column-header-menu { -} - -.viewPanel-summary { -} -.viewPanel-pagingControls { +#loading-message { text-align: center; - margin: 1em 0; + font-size: 300%; + color: #faa; + margin: 1in; + font-style: italic; } +