more polish
git-svn-id: http://google-refine.googlecode.com/svn/trunk@528 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
parent
0778b324de
commit
1a6d1cf6b2
@ -64,7 +64,7 @@ public class ListFacet implements Facet {
|
||||
if (_errorMessage != null) {
|
||||
writer.key("error"); writer.value(_errorMessage);
|
||||
} else if (_choices.size() > 2000) {
|
||||
writer.key("error"); writer.value("Too many choices.");
|
||||
writer.key("error"); writer.value("Too many choices");
|
||||
} else {
|
||||
writer.key("choices"); writer.array();
|
||||
for (NominalFacetChoice choice : _choices) {
|
||||
|
@ -36,7 +36,10 @@ public class FreebaseUtils {
|
||||
static final public String FREEBASE_HOST = "www.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) {
|
||||
return "http://" + host + "/api/service/user_info";
|
||||
@ -77,7 +80,7 @@ public class FreebaseUtils {
|
||||
List<NameValuePair> formparams = new ArrayList<NameValuePair>();
|
||||
formparams.add(new BasicNameValuePair("user", user_info.getString("username")));
|
||||
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("graphport", provider.getHost().equals(FREEBASE_HOST) ? "otg" : "sandbox"));
|
||||
formparams.add(new BasicNameValuePair("payload", triples));
|
||||
|
@ -119,7 +119,7 @@ ListFacet.prototype._initializeUI = function() {
|
||||
'</div></div>' +
|
||||
'<div class="facet-controls" bind="controlsDiv" style="display:none;"><div class="grid-layout layout-tightest layout-full">' +
|
||||
'<table><tr>' +
|
||||
'<td>Sort by ' +
|
||||
'<td>Sort by: ' +
|
||||
'<a href="javascript:{}" bind="sortByNameLink" class="facet-mode-link">Name</a> ' +
|
||||
'<a href="javascript:{}" bind="sortByCountLink" class="facet-mode-link">Count</a>' +
|
||||
'</td>' +
|
||||
|
@ -122,8 +122,8 @@ RangeFacet.prototype._initializeUI = function() {
|
||||
self._updateRest();
|
||||
});
|
||||
this._elmts.removeButton.click(function() {
|
||||
self._remove();
|
||||
});
|
||||
self._remove();
|
||||
});
|
||||
|
||||
this._histogram = new HistogramWidget(this._elmts.histogramDiv, { binColors: [ "#ccccff", "#6666ff" ] });
|
||||
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) {
|
||||
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 tr0 = table.insertRow(0);
|
||||
var tr1 = table.insertRow(1);
|
||||
var choices = $('<div>').addClass("facet-range-choices");
|
||||
|
||||
// ----------------- numeric -----------------
|
||||
|
||||
/*
|
||||
* Numeric
|
||||
*/
|
||||
var td00 = $(tr0.insertCell(0)).attr("width", "1%");
|
||||
var td01 = $(tr0.insertCell(1));
|
||||
|
||||
var numericCheck = $('<input type="checkbox" />').appendTo(td00).change(function() {
|
||||
var numericCheck = $('<input type="checkbox" />').attr("id",facet_id + "-numeric").appendTo(choices).change(function() {
|
||||
self._selectNumeric = !self._selectNumeric;
|
||||
self._updateRest();
|
||||
});
|
||||
if (this._selectNumeric) {
|
||||
numericCheck[0].checked = true;
|
||||
}
|
||||
if (this._selectNumeric) numericCheck.attr("checked","checked");
|
||||
|
||||
$('<span>').text("Numeric ").addClass("facet-choice-label").appendTo(td01);
|
||||
$('<span>').text(this._numericCount).addClass("facet-choice-count").appendTo(td01);
|
||||
var numericLabel = $('<label>').attr("for", facet_id + "-numeric").appendTo(choices);
|
||||
$('<span>').text("Numeric ").addClass("facet-choice-label").appendTo(numericLabel);
|
||||
$('<br>').appendTo(numericLabel);
|
||||
$('<span>').text(this._numericCount).addClass("facet-choice-count").appendTo(numericLabel);
|
||||
|
||||
// ----------------- blank -----------------
|
||||
|
||||
/*
|
||||
* Blank
|
||||
*/
|
||||
var td02 = $(tr0.insertCell(2)).attr("width", "1%");
|
||||
var td03 = $(tr0.insertCell(3));
|
||||
if (this._baseBlankCount === 0) {
|
||||
td02.hide();
|
||||
td03.hide();
|
||||
} else {
|
||||
var blankCheck = $('<input type="checkbox" />').appendTo(td02).change(function() {
|
||||
self._selectBlank = !self._selectBlank;
|
||||
self._updateRest();
|
||||
});
|
||||
if (this._selectBlank) {
|
||||
blankCheck[0].checked = true;
|
||||
}
|
||||
var blankCheck = $('<input type="checkbox" />').attr("id",facet_id + "-blank").appendTo(choices).change(function() {
|
||||
self._selectBlank = !self._selectBlank;
|
||||
self._updateRest();
|
||||
});
|
||||
if (this._selectBlank) blankCheck.attr("checked","checked");
|
||||
|
||||
var blankLabel = $('<label>').attr("for", facet_id + "-blank").appendTo(choices);
|
||||
$('<span>').text("Blank ").addClass("facet-choice-label").appendTo(blankLabel);
|
||||
$('<br>').appendTo(blankLabel);
|
||||
$('<span>').text(this._blankCount).addClass("facet-choice-count").appendTo(blankLabel);
|
||||
|
||||
if (this._baseBlankCount === 0) blankCheck.removeAttr("checked");
|
||||
|
||||
$('<span>').text("Blank ").addClass("facet-choice-label").appendTo(td03);
|
||||
$('<span>').text(this._blankCount).addClass("facet-choice-count").appendTo(td03);
|
||||
}
|
||||
// ----------------- non-numeric -----------------
|
||||
|
||||
/*
|
||||
* Non-Numeric
|
||||
*/
|
||||
var td10 = $(tr1.insertCell(0)).attr("width", "1%");
|
||||
var td11 = $(tr1.insertCell(1));
|
||||
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;
|
||||
}
|
||||
var nonNumericCheck = $('<input type="checkbox" />').attr("id",facet_id + "-non-numeric").appendTo(choices).change(function() {
|
||||
self._selectNonNumeric = !self._selectNonNumeric;
|
||||
self._updateRest();
|
||||
});
|
||||
if (this._selectNonNumeric) nonNumericCheck.attr("checked","checked");
|
||||
|
||||
$('<span>').text("Non-numeric ").addClass("facet-choice-label").appendTo(td11);
|
||||
$('<span>').text(this._nonNumericCount).addClass("facet-choice-count").appendTo(td11);
|
||||
}
|
||||
var nonNumericLabel = $('<label>').attr("for", facet_id + "-non-numeric").appendTo(choices);
|
||||
$('<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
|
||||
*/
|
||||
var td12 = $(tr1.insertCell(2)).attr("width", "1%");
|
||||
var td13 = $(tr1.insertCell(3));
|
||||
if (this._baseErrorCount === 0) {
|
||||
td12.hide();
|
||||
td13.hide();
|
||||
} else {
|
||||
var errorCheck = $('<input type="checkbox" />').appendTo(td12).change(function() {
|
||||
self._selectError = !self._selectError;
|
||||
self._updateRest();
|
||||
});
|
||||
if (this._selectError) {
|
||||
errorCheck[0].checked = true;
|
||||
}
|
||||
// ----------------- error -----------------
|
||||
|
||||
var errorCheck = $('<input type="checkbox" />').attr("id",facet_id + "-error").appendTo(choices).change(function() {
|
||||
self._selectError = !self._selectError;
|
||||
self._updateRest();
|
||||
});
|
||||
if (this._selectError) errorCheck.attr("checked","checked");
|
||||
|
||||
var errorLabel = $('<label>').attr("for", facet_id + "-error").appendTo(choices);
|
||||
$('<span>').text("Error ").addClass("facet-choice-label").appendTo(errorLabel);
|
||||
$('<br>').appendTo(errorLabel);
|
||||
$('<span>').text(this._errorCount).addClass("facet-choice-count").appendTo(errorLabel);
|
||||
|
||||
if (this._baseErrorCount === 0) errorCheck.removeAttr("checked");
|
||||
|
||||
// --------------------------
|
||||
|
||||
$('<span>').text("Error ").addClass("facet-choice-label").appendTo(td13);
|
||||
$('<span>').text(this._errorCount).addClass("facet-choice-count").appendTo(td13);
|
||||
}
|
||||
choices.buttonset().appendTo(container);
|
||||
};
|
||||
|
||||
RangeFacet.prototype._setRangeIndicators = function() {
|
||||
this._elmts.statusDiv.html(this._from + " — " + this._to);
|
||||
this._elmts.statusDiv.html(this._addCommas(this._from.toFixed(2)) + " — " + 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) {
|
||||
if ("min" in data && "max" in data) {
|
||||
this._error = false;
|
||||
|
@ -6,8 +6,19 @@
|
||||
.browsing-panel-indicator {
|
||||
visibility: hidden;
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
top: 0px;
|
||||
width: 50%;
|
||||
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 {
|
||||
visibility: hidden;
|
||||
@ -75,20 +86,19 @@ li.facet-container {
|
||||
}
|
||||
a.facet-mode-link {
|
||||
text-decoration: none;
|
||||
padding: 2px;
|
||||
margin 0px 2px;
|
||||
padding: 1px 3px 2px 3px;
|
||||
-moz-border-radius: 3px;
|
||||
-webkit-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
}
|
||||
a.facet-mode-link:hover {
|
||||
background: #666;
|
||||
color: white;
|
||||
background: #f8f8f8;
|
||||
color: #FF6A00;
|
||||
}
|
||||
a.facet-mode-link.facet-mode-link-selected {
|
||||
background: #888;
|
||||
color: #eee;
|
||||
color: default;
|
||||
background: #f8f8f8;
|
||||
color: #FF6A00;
|
||||
border: 1px solid #ccc;
|
||||
}
|
||||
|
||||
.facet-body {
|
||||
@ -96,7 +106,8 @@ a.facet-mode-link.facet-mode-link-selected {
|
||||
}
|
||||
.facet-body-message {
|
||||
margin: 1em;
|
||||
color: #f88;
|
||||
color: #666;
|
||||
text-align: center;
|
||||
}
|
||||
.facet-body.facet-body-scrollable {
|
||||
height: 17em;
|
||||
@ -173,6 +184,14 @@ img.facet-choice-link {
|
||||
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 {
|
||||
padding: 5px;
|
||||
}
|
||||
|
@ -52,14 +52,14 @@
|
||||
.dialog-busy-frame {
|
||||
width: 300px;
|
||||
border: none;
|
||||
-moz-border-radiust: 25px;
|
||||
-webkit-border-radius: 25px;
|
||||
-moz-border-radiust: 15px;
|
||||
-webkit-border-radius: 15px;
|
||||
}
|
||||
.dialog-busy-body {
|
||||
margin: 1em;
|
||||
text-align: center;
|
||||
font-size: 200%;
|
||||
font-weight: bold;
|
||||
color: #faa;
|
||||
color: #aaa;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user