more polish

git-svn-id: http://google-refine.googlecode.com/svn/trunk@528 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
Stefano Mazzocchi 2010-04-24 02:36:56 +00:00
parent 0778b324de
commit 1a6d1cf6b2
6 changed files with 108 additions and 92 deletions

View File

@ -64,7 +64,7 @@ public class ListFacet implements Facet {
if (_errorMessage != null) { if (_errorMessage != null) {
writer.key("error"); writer.value(_errorMessage); writer.key("error"); writer.value(_errorMessage);
} else if (_choices.size() > 2000) { } else if (_choices.size() > 2000) {
writer.key("error"); writer.value("Too many choices."); writer.key("error"); writer.value("Too many choices");
} else { } else {
writer.key("choices"); writer.array(); writer.key("choices"); writer.array();
for (NominalFacetChoice choice : _choices) { for (NominalFacetChoice choice : _choices) {

View File

@ -36,7 +36,10 @@ public class FreebaseUtils {
static final public String FREEBASE_HOST = "www.freebase.com"; static final public String FREEBASE_HOST = "www.freebase.com";
static final public String FREEBASE_SANDBOX_HOST = "www.sandbox-freebase.com"; static final public String FREEBASE_SANDBOX_HOST = "www.sandbox-freebase.com";
static final private String FREEQ_URL = "http://data.labs.freebase.com/freeq/prod/"; //static final private String FREEQ_URL = "http://data.labs.freebase.com/freeq/prod/";
static final private String FREEQ_URL = "http://zucchini.dmz.sjc1.metaweb.com:5000/unittest";
static final private String GRIDWORKS_ID = "/en/gridworks";
private static String getUserInfoURL(String host) { private static String getUserInfoURL(String host) {
return "http://" + host + "/api/service/user_info"; return "http://" + host + "/api/service/user_info";
@ -77,7 +80,7 @@ public class FreebaseUtils {
List<NameValuePair> formparams = new ArrayList<NameValuePair>(); List<NameValuePair> formparams = new ArrayList<NameValuePair>();
formparams.add(new BasicNameValuePair("user", user_info.getString("username"))); formparams.add(new BasicNameValuePair("user", user_info.getString("username")));
formparams.add(new BasicNameValuePair("action_type", "LOAD_TRIPLE")); formparams.add(new BasicNameValuePair("action_type", "LOAD_TRIPLE"));
formparams.add(new BasicNameValuePair("operator", "gridworks")); formparams.add(new BasicNameValuePair("operator", GRIDWORKS_ID));
formparams.add(new BasicNameValuePair("mdo_info", info)); formparams.add(new BasicNameValuePair("mdo_info", info));
formparams.add(new BasicNameValuePair("graphport", provider.getHost().equals(FREEBASE_HOST) ? "otg" : "sandbox")); formparams.add(new BasicNameValuePair("graphport", provider.getHost().equals(FREEBASE_HOST) ? "otg" : "sandbox"));
formparams.add(new BasicNameValuePair("payload", triples)); formparams.add(new BasicNameValuePair("payload", triples));

View File

@ -119,7 +119,7 @@ ListFacet.prototype._initializeUI = function() {
'</div></div>' + '</div></div>' +
'<div class="facet-controls" bind="controlsDiv" style="display:none;"><div class="grid-layout layout-tightest layout-full">' + '<div class="facet-controls" bind="controlsDiv" style="display:none;"><div class="grid-layout layout-tightest layout-full">' +
'<table><tr>' + '<table><tr>' +
'<td>Sort by ' + '<td>Sort by: ' +
'<a href="javascript:{}" bind="sortByNameLink" class="facet-mode-link">Name</a> ' + '<a href="javascript:{}" bind="sortByNameLink" class="facet-mode-link">Name</a> ' +
'<a href="javascript:{}" bind="sortByCountLink" class="facet-mode-link">Count</a>' + '<a href="javascript:{}" bind="sortByCountLink" class="facet-mode-link">Count</a>' +
'</td>' + '</td>' +

View File

@ -122,8 +122,8 @@ RangeFacet.prototype._initializeUI = function() {
self._updateRest(); self._updateRest();
}); });
this._elmts.removeButton.click(function() { this._elmts.removeButton.click(function() {
self._remove(); self._remove();
}); });
this._histogram = new HistogramWidget(this._elmts.histogramDiv, { binColors: [ "#ccccff", "#6666ff" ] }); this._histogram = new HistogramWidget(this._elmts.histogramDiv, { binColors: [ "#ccccff", "#6666ff" ] });
this._sliderWidget = new SliderWidget(this._elmts.sliderWidgetDiv); this._sliderWidget = new SliderWidget(this._elmts.sliderWidgetDiv);
@ -147,96 +147,90 @@ RangeFacet.prototype._renderOtherChoices = function() {
if (this._baseNonNumericCount === 0 && this._baseBlankCount === 0 && this._baseErrorCount === 0) { if (this._baseNonNumericCount === 0 && this._baseBlankCount === 0 && this._baseErrorCount === 0) {
return; return;
} }
var facet_id = this._div.attr("id");
var table = $('<table>').attr("cellpadding", "0").attr("cellspacing", "1").css("white-space", "pre").appendTo(container)[0]; var choices = $('<div>').addClass("facet-range-choices");
var tr0 = table.insertRow(0);
var tr1 = table.insertRow(1); // ----------------- numeric -----------------
/* var numericCheck = $('<input type="checkbox" />').attr("id",facet_id + "-numeric").appendTo(choices).change(function() {
* Numeric
*/
var td00 = $(tr0.insertCell(0)).attr("width", "1%");
var td01 = $(tr0.insertCell(1));
var numericCheck = $('<input type="checkbox" />').appendTo(td00).change(function() {
self._selectNumeric = !self._selectNumeric; self._selectNumeric = !self._selectNumeric;
self._updateRest(); self._updateRest();
}); });
if (this._selectNumeric) { if (this._selectNumeric) numericCheck.attr("checked","checked");
numericCheck[0].checked = true;
}
$('<span>').text("Numeric ").addClass("facet-choice-label").appendTo(td01); var numericLabel = $('<label>').attr("for", facet_id + "-numeric").appendTo(choices);
$('<span>').text(this._numericCount).addClass("facet-choice-count").appendTo(td01); $('<span>').text("Numeric ").addClass("facet-choice-label").appendTo(numericLabel);
$('<br>').appendTo(numericLabel);
$('<span>').text(this._numericCount).addClass("facet-choice-count").appendTo(numericLabel);
// ----------------- blank -----------------
/* var blankCheck = $('<input type="checkbox" />').attr("id",facet_id + "-blank").appendTo(choices).change(function() {
* Blank self._selectBlank = !self._selectBlank;
*/ self._updateRest();
var td02 = $(tr0.insertCell(2)).attr("width", "1%"); });
var td03 = $(tr0.insertCell(3)); if (this._selectBlank) blankCheck.attr("checked","checked");
if (this._baseBlankCount === 0) {
td02.hide(); var blankLabel = $('<label>').attr("for", facet_id + "-blank").appendTo(choices);
td03.hide(); $('<span>').text("Blank ").addClass("facet-choice-label").appendTo(blankLabel);
} else { $('<br>').appendTo(blankLabel);
var blankCheck = $('<input type="checkbox" />').appendTo(td02).change(function() { $('<span>').text(this._blankCount).addClass("facet-choice-count").appendTo(blankLabel);
self._selectBlank = !self._selectBlank;
self._updateRest(); if (this._baseBlankCount === 0) blankCheck.removeAttr("checked");
});
if (this._selectBlank) {
blankCheck[0].checked = true;
}
$('<span>').text("Blank ").addClass("facet-choice-label").appendTo(td03); // ----------------- non-numeric -----------------
$('<span>').text(this._blankCount).addClass("facet-choice-count").appendTo(td03);
}
/* var nonNumericCheck = $('<input type="checkbox" />').attr("id",facet_id + "-non-numeric").appendTo(choices).change(function() {
* Non-Numeric self._selectNonNumeric = !self._selectNonNumeric;
*/ self._updateRest();
var td10 = $(tr1.insertCell(0)).attr("width", "1%"); });
var td11 = $(tr1.insertCell(1)); if (this._selectNonNumeric) nonNumericCheck.attr("checked","checked");
if (this._baseNonNumericCount === 0) {
td10.hide();
td11.hide();
} else {
var nonNumericCheck = $('<input type="checkbox" />').appendTo(td10).change(function() {
self._selectNonNumeric = !self._selectNonNumeric;
self._updateRest();
});
if (this._selectNonNumeric) {
nonNumericCheck[0].checked = true;
}
$('<span>').text("Non-numeric ").addClass("facet-choice-label").appendTo(td11); var nonNumericLabel = $('<label>').attr("for", facet_id + "-non-numeric").appendTo(choices);
$('<span>').text(this._nonNumericCount).addClass("facet-choice-count").appendTo(td11); $('<span>').text("Non-numeric ").addClass("facet-choice-label").appendTo(nonNumericLabel);
} $('<br>').appendTo(nonNumericLabel);
$('<span>').text(this._nonNumericCount).addClass("facet-choice-count").appendTo(nonNumericLabel);
if (this._baseNonNumericCount === 0) nonNumericCheck.removeAttr("checked");
/* // ----------------- error -----------------
* Error
*/ var errorCheck = $('<input type="checkbox" />').attr("id",facet_id + "-error").appendTo(choices).change(function() {
var td12 = $(tr1.insertCell(2)).attr("width", "1%"); self._selectError = !self._selectError;
var td13 = $(tr1.insertCell(3)); self._updateRest();
if (this._baseErrorCount === 0) { });
td12.hide(); if (this._selectError) errorCheck.attr("checked","checked");
td13.hide();
} else { var errorLabel = $('<label>').attr("for", facet_id + "-error").appendTo(choices);
var errorCheck = $('<input type="checkbox" />').appendTo(td12).change(function() { $('<span>').text("Error ").addClass("facet-choice-label").appendTo(errorLabel);
self._selectError = !self._selectError; $('<br>').appendTo(errorLabel);
self._updateRest(); $('<span>').text(this._errorCount).addClass("facet-choice-count").appendTo(errorLabel);
});
if (this._selectError) { if (this._baseErrorCount === 0) errorCheck.removeAttr("checked");
errorCheck[0].checked = true;
} // --------------------------
$('<span>').text("Error ").addClass("facet-choice-label").appendTo(td13); choices.buttonset().appendTo(container);
$('<span>').text(this._errorCount).addClass("facet-choice-count").appendTo(td13);
}
}; };
RangeFacet.prototype._setRangeIndicators = function() { RangeFacet.prototype._setRangeIndicators = function() {
this._elmts.statusDiv.html(this._from + " &mdash; " + this._to); this._elmts.statusDiv.html(this._addCommas(this._from.toFixed(2)) + " &mdash; " + this._addCommas(this._to.toFixed(2)));
}; };
RangeFacet.prototype._addCommas = function(nStr) {
nStr += '';
x = nStr.split('.');
x1 = x[0];
x2 = x.length > 1 ? '.' + x[1] : '';
var rgx = /(\d+)(\d{3})/;
while (rgx.test(x1)) {
x1 = x1.replace(rgx, '$1' + ',' + '$2');
}
return x1 + x2;
}
RangeFacet.prototype.updateState = function(data) { RangeFacet.prototype.updateState = function(data) {
if ("min" in data && "max" in data) { if ("min" in data && "max" in data) {
this._error = false; this._error = false;

View File

@ -6,8 +6,19 @@
.browsing-panel-indicator { .browsing-panel-indicator {
visibility: hidden; visibility: hidden;
position: absolute; position: absolute;
width: 100%; width: 50%;
top: 0px; margin: 0px;
top: 0em;
left: 20%;
text-align: center;
background-color: #fff;
padding: 4px 4px;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
border: 1px solid #ccc;
}
.browsing-panel-indicator img {
vertical-align: text-top;
} }
.browsing-panel-controls { .browsing-panel-controls {
visibility: hidden; visibility: hidden;
@ -75,20 +86,19 @@ li.facet-container {
} }
a.facet-mode-link { a.facet-mode-link {
text-decoration: none; text-decoration: none;
padding: 2px; padding: 1px 3px 2px 3px;
margin 0px 2px;
-moz-border-radius: 3px; -moz-border-radius: 3px;
-webkit-border-radius: 3px; -webkit-border-radius: 3px;
border-radius: 3px; border-radius: 3px;
} }
a.facet-mode-link:hover { a.facet-mode-link:hover {
background: #666; background: #f8f8f8;
color: white; color: #FF6A00;
} }
a.facet-mode-link.facet-mode-link-selected { a.facet-mode-link.facet-mode-link-selected {
background: #888; background: #f8f8f8;
color: #eee; color: #FF6A00;
color: default; border: 1px solid #ccc;
} }
.facet-body { .facet-body {
@ -96,7 +106,8 @@ a.facet-mode-link.facet-mode-link-selected {
} }
.facet-body-message { .facet-body-message {
margin: 1em; margin: 1em;
color: #f88; color: #666;
text-align: center;
} }
.facet-body.facet-body-scrollable { .facet-body.facet-body-scrollable {
height: 17em; height: 17em;
@ -173,6 +184,14 @@ img.facet-choice-link {
text-align: center; text-align: center;
} }
.facet-range-choices {
margin-bottom: 0.8em;
text-align: center;
}
.facet-range-choices .ui-button-text {
line-height: 1;
padding: 0.1em 0.4em;
}
.facet-text-body { .facet-text-body {
padding: 5px; padding: 5px;
} }

View File

@ -52,14 +52,14 @@
.dialog-busy-frame { .dialog-busy-frame {
width: 300px; width: 300px;
border: none; border: none;
-moz-border-radiust: 25px; -moz-border-radiust: 15px;
-webkit-border-radius: 25px; -webkit-border-radius: 15px;
} }
.dialog-busy-body { .dialog-busy-body {
margin: 1em; margin: 1em;
text-align: center; text-align: center;
font-size: 200%; font-size: 200%;
font-weight: bold; font-weight: bold;
color: #faa; color: #aaa;
} }