Updated Numeric to Double
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-widgetx@111861 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
c7823d700b
commit
082abd7138
|
@ -61,14 +61,6 @@ public class FiltersGenerator {
|
||||||
new NumberPropertyEditor.DoublePropertyEditor());
|
new NumberPropertyEditor.DoublePropertyEditor());
|
||||||
filters.add(doubleFilt);
|
filters.add(doubleFilt);
|
||||||
break;
|
break;
|
||||||
case FLOAT:
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
NumericFilter<DataRow, Float> floatFilt = new NumericFilter<DataRow, Float>(
|
|
||||||
(ValueProvider<DataRow, Float>) dataRowColConfig
|
|
||||||
.getValueProvider(),
|
|
||||||
new NumberPropertyEditor.FloatPropertyEditor());
|
|
||||||
filters.add(floatFilt);
|
|
||||||
break;
|
|
||||||
case INTEGER:
|
case INTEGER:
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
NumericFilter<DataRow, Integer> integerFilt = new NumericFilter<DataRow, Integer>(
|
NumericFilter<DataRow, Integer> integerFilt = new NumericFilter<DataRow, Integer>(
|
||||||
|
|
|
@ -60,7 +60,6 @@ public class JSonValueConverter {
|
||||||
case BOOLEAN: row.set(key, Boolean.valueOf(json.getAsBool(key.getJSonIndex()))); break;
|
case BOOLEAN: row.set(key, Boolean.valueOf(json.getAsBool(key.getJSonIndex()))); break;
|
||||||
case DATE: row.set(key, new Date((long)json.getAsNumber(key.getJSonIndex()))); break;
|
case DATE: row.set(key, new Date((long)json.getAsNumber(key.getJSonIndex()))); break;
|
||||||
case DOUBLE: row.set(key, Double.valueOf(json.getAsNumber(key.getJSonIndex()))); break;
|
case DOUBLE: row.set(key, Double.valueOf(json.getAsNumber(key.getJSonIndex()))); break;
|
||||||
case FLOAT: row.set(key, Float.valueOf((float)json.getAsNumber(key.getJSonIndex()))); break;
|
|
||||||
case INTEGER: row.set(key, Integer.valueOf((int)json.getAsNumber(key.getJSonIndex()))); break;
|
case INTEGER: row.set(key, Integer.valueOf((int)json.getAsNumber(key.getJSonIndex()))); break;
|
||||||
case LONG: row.set(key, Long.valueOf((long)json.getAsNumber(key.getJSonIndex()))); break;
|
case LONG: row.set(key, Long.valueOf((long)json.getAsNumber(key.getJSonIndex()))); break;
|
||||||
case STRING: row.set(key, json.getAsString(key.getJSonIndex())); break;
|
case STRING: row.set(key, json.getAsString(key.getJSonIndex())); break;
|
||||||
|
|
|
@ -146,23 +146,7 @@ public final class JSonValue extends JavaScriptObject {
|
||||||
this[key] = value;
|
this[key] = value;
|
||||||
}-*/;
|
}-*/;
|
||||||
|
|
||||||
public native Float getAsFloat(String key)
|
|
||||||
/*-{
|
|
||||||
var value = this[key];
|
|
||||||
if ((typeof value) == "undefined") return null;
|
|
||||||
if ((typeof value) == "number") return @java.lang.Float::new(D)(value);
|
|
||||||
return value;
|
|
||||||
}-*/;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the specified value.
|
|
||||||
* @param key the key.
|
|
||||||
* @param value the value to set.
|
|
||||||
*/
|
|
||||||
public native void set(String key, Float value)
|
|
||||||
/*-{
|
|
||||||
this[key] = value;
|
|
||||||
}-*/;
|
|
||||||
|
|
||||||
public native Integer getAsInteger(String key)
|
public native Integer getAsInteger(String key)
|
||||||
/*-{
|
/*-{
|
||||||
|
|
|
@ -57,8 +57,14 @@ public class ColumnConfigGenerator {
|
||||||
String style = "style='color: "
|
String style = "style='color: "
|
||||||
+ (value ? "green" : "black") + "'";
|
+ (value ? "green" : "black") + "'";
|
||||||
|
|
||||||
sb.appendHtmlConstant("<span " + style + " title='"+new SafeHtmlBuilder().append(value).toSafeHtml().asString()+"'>"+
|
sb.appendHtmlConstant("<span "
|
||||||
new SafeHtmlBuilder().append(value).toSafeHtml().asString()+"</span>");
|
+ style
|
||||||
|
+ " title='"
|
||||||
|
+ new SafeHtmlBuilder().append(value)
|
||||||
|
.toSafeHtml().asString()
|
||||||
|
+ "'>"
|
||||||
|
+ new SafeHtmlBuilder().append(value)
|
||||||
|
.toSafeHtml().asString() + "</span>");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -93,13 +99,6 @@ public class ColumnConfigGenerator {
|
||||||
ssb.append(safeStyle);
|
ssb.append(safeStyle);
|
||||||
ssb.textAlign(TextAlign.RIGHT);
|
ssb.textAlign(TextAlign.RIGHT);
|
||||||
break;
|
break;
|
||||||
case FLOAT:
|
|
||||||
columnConfig = ColumnConfigGenerator
|
|
||||||
.<Float> create(columnDefinition);
|
|
||||||
safeStyle= columnConfig.getColumnStyle();
|
|
||||||
ssb.append(safeStyle);
|
|
||||||
ssb.textAlign(TextAlign.RIGHT);
|
|
||||||
break;
|
|
||||||
case INTEGER:
|
case INTEGER:
|
||||||
columnConfig = ColumnConfigGenerator
|
columnConfig = ColumnConfigGenerator
|
||||||
.<Integer> create(columnDefinition);
|
.<Integer> create(columnDefinition);
|
||||||
|
@ -148,14 +147,17 @@ public class ColumnConfigGenerator {
|
||||||
+ SafeHtmlUtils.htmlEscape(columnDefinition.getLabel())
|
+ SafeHtmlUtils.htmlEscape(columnDefinition.getLabel())
|
||||||
+ "</bold><BR>"
|
+ "</bold><BR>"
|
||||||
+ "<em style='text-decoration:underline;'>"
|
+ "<em style='text-decoration:underline;'>"
|
||||||
+ SafeHtmlUtils.htmlEscape(columnDefinition.getColumnTypeName())
|
+ SafeHtmlUtils.htmlEscape(columnDefinition
|
||||||
|
.getColumnTypeName())
|
||||||
+ "</em><bold>"
|
+ "</em><bold>"
|
||||||
+ SafeHtmlUtils.htmlEscape(local)
|
+ SafeHtmlUtils.htmlEscape(local)
|
||||||
+ "</bold><BR>"
|
+ "</bold><BR>"
|
||||||
+ "<em>"
|
+ "<em>"
|
||||||
+ SafeHtmlUtils.htmlEscape(columnDefinition.getColumnDataType())
|
+ SafeHtmlUtils.htmlEscape(columnDefinition
|
||||||
|
.getColumnDataType())
|
||||||
+ "</em><BR>"
|
+ "</em><BR>"
|
||||||
+ SafeHtmlUtils.htmlEscape(columnDefinition.getTooltipMessage()) + "</p>");
|
+ SafeHtmlUtils.htmlEscape(columnDefinition
|
||||||
|
.getTooltipMessage()) + "</p>");
|
||||||
columnConfig.setToolTip(tooltipMessage.toSafeHtml());
|
columnConfig.setToolTip(tooltipMessage.toSafeHtml());
|
||||||
|
|
||||||
return columnConfig;
|
return columnConfig;
|
||||||
|
@ -196,13 +198,7 @@ public class ColumnConfigGenerator {
|
||||||
new NumberField<Double>(
|
new NumberField<Double>(
|
||||||
new NumberPropertyEditor.DoublePropertyEditor()));
|
new NumberPropertyEditor.DoublePropertyEditor()));
|
||||||
break;
|
break;
|
||||||
case FLOAT:
|
|
||||||
editableGrid
|
|
||||||
.addEditor(
|
|
||||||
(ColumnConfig<DataRow, Float>) columnConfig,
|
|
||||||
new NumberField<Float>(
|
|
||||||
new NumberPropertyEditor.FloatPropertyEditor()));
|
|
||||||
break;
|
|
||||||
case INTEGER:
|
case INTEGER:
|
||||||
editableGrid
|
editableGrid
|
||||||
.addEditor(
|
.addEditor(
|
||||||
|
|
|
@ -151,16 +151,7 @@ public class GridJSonBuilder {
|
||||||
json.append((value==null)?JSONConstants.NULL:value);
|
json.append((value==null)?JSONConstants.NULL:value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds a new value in the row.
|
|
||||||
* @param id the value id.
|
|
||||||
* @param value the value to insert.
|
|
||||||
*/
|
|
||||||
public void addValue(String id, Float value)
|
|
||||||
{
|
|
||||||
addValueKey(id);
|
|
||||||
json.append((value==null)?JSONConstants.NULL:value);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a new value in the row.
|
* Adds a new value in the row.
|
||||||
|
|
|
@ -138,17 +138,7 @@ public class GridJSonWriter {
|
||||||
writer.append((value==null)?JSONConstants.NULL:String.valueOf(value));
|
writer.append((value==null)?JSONConstants.NULL:String.valueOf(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds a new value in the row.
|
|
||||||
* @param id the value id.
|
|
||||||
* @param value the value to insert.
|
|
||||||
* @throws IOException
|
|
||||||
*/
|
|
||||||
public void addValue(String id, Float value) throws IOException
|
|
||||||
{
|
|
||||||
addValueKey(id);
|
|
||||||
writer.append((value==null)?JSONConstants.NULL:String.valueOf(value));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a new value in the row.
|
* Adds a new value in the row.
|
||||||
|
|
|
@ -15,7 +15,6 @@ public enum ValueType implements Serializable {
|
||||||
STRING,
|
STRING,
|
||||||
INTEGER,
|
INTEGER,
|
||||||
BOOLEAN,
|
BOOLEAN,
|
||||||
FLOAT,
|
|
||||||
DOUBLE,
|
DOUBLE,
|
||||||
LONG,
|
LONG,
|
||||||
DATE,
|
DATE,
|
||||||
|
|
|
@ -27,7 +27,7 @@ public class TestGridJSonBuilder {
|
||||||
gridJSonWriter.addValue("boolean", false);
|
gridJSonWriter.addValue("boolean", false);
|
||||||
gridJSonWriter.addValue("date", new Date(1));
|
gridJSonWriter.addValue("date", new Date(1));
|
||||||
gridJSonWriter.addValue("double", 2.1);
|
gridJSonWriter.addValue("double", 2.1);
|
||||||
gridJSonWriter.addValue("float", 2.3f);
|
//gridJSonWriter.addValue("float", 2.3f);
|
||||||
gridJSonWriter.addValue("long", 123l);
|
gridJSonWriter.addValue("long", 123l);
|
||||||
gridJSonWriter.addValue("string", "This is a string");
|
gridJSonWriter.addValue("string", "This is a string");
|
||||||
gridJSonWriter.endRow();
|
gridJSonWriter.endRow();
|
||||||
|
|
|
@ -53,7 +53,6 @@ public class TestSpeed {
|
||||||
tableDefinition.addColumn(new ColumnDefinition("boolean", "boolean", "boolean", ValueType.BOOLEAN, 1, true, true, ColumnType.USER));
|
tableDefinition.addColumn(new ColumnDefinition("boolean", "boolean", "boolean", ValueType.BOOLEAN, 1, true, true, ColumnType.USER));
|
||||||
tableDefinition.addColumn(new ColumnDefinition("date", "date", "date", ValueType.DATE, 1, true, true, ColumnType.USER));
|
tableDefinition.addColumn(new ColumnDefinition("date", "date", "date", ValueType.DATE, 1, true, true, ColumnType.USER));
|
||||||
tableDefinition.addColumn(new ColumnDefinition("double", "double", "double", ValueType.DOUBLE, 1, true, true, ColumnType.USER));
|
tableDefinition.addColumn(new ColumnDefinition("double", "double", "double", ValueType.DOUBLE, 1, true, true, ColumnType.USER));
|
||||||
tableDefinition.addColumn(new ColumnDefinition("float", "float", "float", ValueType.FLOAT, 1, true, true, ColumnType.USER));
|
|
||||||
tableDefinition.addColumn(new ColumnDefinition("long", "long", "long", ValueType.LONG, 1, true, true, ColumnType.USER));
|
tableDefinition.addColumn(new ColumnDefinition("long", "long", "long", ValueType.LONG, 1, true, true, ColumnType.USER));
|
||||||
tableDefinition.addColumn(new ColumnDefinition("string", "string", "string", ValueType.STRING, 1, true, true, ColumnType.USER));
|
tableDefinition.addColumn(new ColumnDefinition("string", "string", "string", ValueType.STRING, 1, true, true, ColumnType.USER));
|
||||||
|
|
||||||
|
@ -72,7 +71,6 @@ public class TestSpeed {
|
||||||
tableJSonWriter.addValue("boolean", false);
|
tableJSonWriter.addValue("boolean", false);
|
||||||
tableJSonWriter.addValue("date", new Date(1));
|
tableJSonWriter.addValue("date", new Date(1));
|
||||||
tableJSonWriter.addValue("double", 2.1);
|
tableJSonWriter.addValue("double", 2.1);
|
||||||
tableJSonWriter.addValue("float", 2.3f);
|
|
||||||
tableJSonWriter.addValue("long", 123l);
|
tableJSonWriter.addValue("long", 123l);
|
||||||
tableJSonWriter.addValue("string", "This is a string");
|
tableJSonWriter.addValue("string", "This is a string");
|
||||||
tableJSonWriter.endRow();
|
tableJSonWriter.endRow();
|
||||||
|
@ -99,7 +97,6 @@ public class TestSpeed {
|
||||||
tableDefinition.addColumn(new ColumnDefinition("boolean", "boolean", "boolean", ValueType.BOOLEAN, 1, true, true, ColumnType.USER));
|
tableDefinition.addColumn(new ColumnDefinition("boolean", "boolean", "boolean", ValueType.BOOLEAN, 1, true, true, ColumnType.USER));
|
||||||
tableDefinition.addColumn(new ColumnDefinition("date", "date", "date", ValueType.DATE, 1, true, true, ColumnType.USER));
|
tableDefinition.addColumn(new ColumnDefinition("date", "date", "date", ValueType.DATE, 1, true, true, ColumnType.USER));
|
||||||
tableDefinition.addColumn(new ColumnDefinition("double", "double", "double", ValueType.DOUBLE, 1, true, true, ColumnType.USER));
|
tableDefinition.addColumn(new ColumnDefinition("double", "double", "double", ValueType.DOUBLE, 1, true, true, ColumnType.USER));
|
||||||
tableDefinition.addColumn(new ColumnDefinition("float", "float", "float", ValueType.FLOAT, 1, true, true, ColumnType.USER));
|
|
||||||
tableDefinition.addColumn(new ColumnDefinition("long", "long", "long", ValueType.LONG, 1, true, true, ColumnType.USER));
|
tableDefinition.addColumn(new ColumnDefinition("long", "long", "long", ValueType.LONG, 1, true, true, ColumnType.USER));
|
||||||
tableDefinition.addColumn(new ColumnDefinition("string", "string", "string", ValueType.STRING, 1, true, true, ColumnType.USER));
|
tableDefinition.addColumn(new ColumnDefinition("string", "string", "string", ValueType.STRING, 1, true, true, ColumnType.USER));
|
||||||
|
|
||||||
|
@ -115,7 +112,6 @@ public class TestSpeed {
|
||||||
gridJSonWriter.addValue("boolean", false);
|
gridJSonWriter.addValue("boolean", false);
|
||||||
gridJSonWriter.addValue("date", new Date(1));
|
gridJSonWriter.addValue("date", new Date(1));
|
||||||
gridJSonWriter.addValue("double", 2.1);
|
gridJSonWriter.addValue("double", 2.1);
|
||||||
gridJSonWriter.addValue("float", 2.3f);
|
|
||||||
gridJSonWriter.addValue("long", 123l);
|
gridJSonWriter.addValue("long", 123l);
|
||||||
gridJSonWriter.addValue("string", "This is a string");
|
gridJSonWriter.addValue("string", "This is a string");
|
||||||
gridJSonWriter.endRow();
|
gridJSonWriter.endRow();
|
||||||
|
|
|
@ -28,7 +28,6 @@ public class TestTableJSonBuilder {
|
||||||
tableDefinition.addColumn(new ColumnDefinition("boolean", "boolean", "boolean", ValueType.BOOLEAN, 1, true, true, ColumnType.USER));
|
tableDefinition.addColumn(new ColumnDefinition("boolean", "boolean", "boolean", ValueType.BOOLEAN, 1, true, true, ColumnType.USER));
|
||||||
tableDefinition.addColumn(new ColumnDefinition("date", "date", "date", ValueType.DATE, 1, true, true, ColumnType.USER));
|
tableDefinition.addColumn(new ColumnDefinition("date", "date", "date", ValueType.DATE, 1, true, true, ColumnType.USER));
|
||||||
tableDefinition.addColumn(new ColumnDefinition("double", "double", "double", ValueType.DOUBLE, 1, true, true, ColumnType.USER));
|
tableDefinition.addColumn(new ColumnDefinition("double", "double", "double", ValueType.DOUBLE, 1, true, true, ColumnType.USER));
|
||||||
tableDefinition.addColumn(new ColumnDefinition("float", "float", "float", ValueType.FLOAT, 1, true, true, ColumnType.USER));
|
|
||||||
tableDefinition.addColumn(new ColumnDefinition("long", "long", "long", ValueType.LONG, 1, true, true, ColumnType.USER));
|
tableDefinition.addColumn(new ColumnDefinition("long", "long", "long", ValueType.LONG, 1, true, true, ColumnType.USER));
|
||||||
tableDefinition.addColumn(new ColumnDefinition("string", "string", "string", ValueType.STRING, 1, true, true, ColumnType.USER));
|
tableDefinition.addColumn(new ColumnDefinition("string", "string", "string", ValueType.STRING, 1, true, true, ColumnType.USER));
|
||||||
|
|
||||||
|
@ -40,7 +39,6 @@ public class TestTableJSonBuilder {
|
||||||
gridJSonWriter.addValue("boolean", false);
|
gridJSonWriter.addValue("boolean", false);
|
||||||
gridJSonWriter.addValue("date", new Date(1));
|
gridJSonWriter.addValue("date", new Date(1));
|
||||||
gridJSonWriter.addValue("double", 2.1);
|
gridJSonWriter.addValue("double", 2.1);
|
||||||
gridJSonWriter.addValue("float", 2.3f);
|
|
||||||
gridJSonWriter.addValue("long", 123l);
|
gridJSonWriter.addValue("long", 123l);
|
||||||
gridJSonWriter.addValue("string", "This is a string");
|
gridJSonWriter.addValue("string", "This is a string");
|
||||||
gridJSonWriter.endRow();
|
gridJSonWriter.endRow();
|
||||||
|
|
|
@ -31,7 +31,6 @@ public class TestTableJSonWriter {
|
||||||
tableDefinition.addColumn(new ColumnDefinition("boolean", "boolean", "boolean", ValueType.BOOLEAN, 1, true, true, ColumnType.USER));
|
tableDefinition.addColumn(new ColumnDefinition("boolean", "boolean", "boolean", ValueType.BOOLEAN, 1, true, true, ColumnType.USER));
|
||||||
tableDefinition.addColumn(new ColumnDefinition("date", "date", "date", ValueType.DATE, 1, true, true, ColumnType.USER));
|
tableDefinition.addColumn(new ColumnDefinition("date", "date", "date", ValueType.DATE, 1, true, true, ColumnType.USER));
|
||||||
tableDefinition.addColumn(new ColumnDefinition("double", "double", "double", ValueType.DOUBLE, 1, true, true, ColumnType.USER));
|
tableDefinition.addColumn(new ColumnDefinition("double", "double", "double", ValueType.DOUBLE, 1, true, true, ColumnType.USER));
|
||||||
tableDefinition.addColumn(new ColumnDefinition("float", "float", "float", ValueType.FLOAT, 1, true, true, ColumnType.USER));
|
|
||||||
tableDefinition.addColumn(new ColumnDefinition("long", "long", "long", ValueType.LONG, 1, true, true, ColumnType.USER));
|
tableDefinition.addColumn(new ColumnDefinition("long", "long", "long", ValueType.LONG, 1, true, true, ColumnType.USER));
|
||||||
tableDefinition.addColumn(new ColumnDefinition("string", "string", "string", ValueType.STRING, 1, true, true, ColumnType.USER));
|
tableDefinition.addColumn(new ColumnDefinition("string", "string", "string", ValueType.STRING, 1, true, true, ColumnType.USER));
|
||||||
|
|
||||||
|
@ -50,7 +49,6 @@ public class TestTableJSonWriter {
|
||||||
tableJSonWriter.addValue("boolean", false);
|
tableJSonWriter.addValue("boolean", false);
|
||||||
tableJSonWriter.addValue("date", new Date(1));
|
tableJSonWriter.addValue("date", new Date(1));
|
||||||
tableJSonWriter.addValue("double", 2.1);
|
tableJSonWriter.addValue("double", 2.1);
|
||||||
tableJSonWriter.addValue("float", 2.3f);
|
|
||||||
tableJSonWriter.addValue("long", 123l);
|
tableJSonWriter.addValue("long", 123l);
|
||||||
tableJSonWriter.addValue("string", "This is a string");
|
tableJSonWriter.addValue("string", "This is a string");
|
||||||
tableJSonWriter.endRow();
|
tableJSonWriter.endRow();
|
||||||
|
|
Loading…
Reference in New Issue