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());
|
||||
filters.add(doubleFilt);
|
||||
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:
|
||||
@SuppressWarnings("unchecked")
|
||||
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 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 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 LONG: row.set(key, Long.valueOf((long)json.getAsNumber(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;
|
||||
}-*/;
|
||||
|
||||
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)
|
||||
/*-{
|
||||
|
|
|
@ -38,7 +38,7 @@ public class ColumnConfigGenerator {
|
|||
DataRowColumnConfig<?> columnConfig = null;
|
||||
|
||||
SafeStyles safeStyle;
|
||||
SafeStylesBuilder ssb= new SafeStylesBuilder();
|
||||
SafeStylesBuilder ssb = new SafeStylesBuilder();
|
||||
|
||||
switch (columnDefinition.getValueType()) {
|
||||
case BOOLEAN:
|
||||
|
@ -57,12 +57,18 @@ public class ColumnConfigGenerator {
|
|||
String style = "style='color: "
|
||||
+ (value ? "green" : "black") + "'";
|
||||
|
||||
sb.appendHtmlConstant("<span " + style + " title='"+new SafeHtmlBuilder().append(value).toSafeHtml().asString()+"'>"+
|
||||
new SafeHtmlBuilder().append(value).toSafeHtml().asString()+"</span>");
|
||||
sb.appendHtmlConstant("<span "
|
||||
+ style
|
||||
+ " title='"
|
||||
+ new SafeHtmlBuilder().append(value)
|
||||
.toSafeHtml().asString()
|
||||
+ "'>"
|
||||
+ new SafeHtmlBuilder().append(value)
|
||||
.toSafeHtml().asString() + "</span>");
|
||||
}
|
||||
});
|
||||
}
|
||||
safeStyle= columnConfig.getColumnStyle();
|
||||
safeStyle = columnConfig.getColumnStyle();
|
||||
ssb.append(safeStyle);
|
||||
ssb.textAlign(TextAlign.CENTER);
|
||||
break;
|
||||
|
@ -82,48 +88,41 @@ public class ColumnConfigGenerator {
|
|||
|
||||
}
|
||||
});
|
||||
safeStyle= columnConfig.getColumnStyle();
|
||||
safeStyle = columnConfig.getColumnStyle();
|
||||
ssb.append(safeStyle);
|
||||
ssb.textAlign(TextAlign.CENTER);
|
||||
break;
|
||||
case DOUBLE:
|
||||
columnConfig = ColumnConfigGenerator
|
||||
.<Double> create(columnDefinition);
|
||||
safeStyle= columnConfig.getColumnStyle();
|
||||
ssb.append(safeStyle);
|
||||
ssb.textAlign(TextAlign.RIGHT);
|
||||
break;
|
||||
case FLOAT:
|
||||
columnConfig = ColumnConfigGenerator
|
||||
.<Float> create(columnDefinition);
|
||||
safeStyle= columnConfig.getColumnStyle();
|
||||
safeStyle = columnConfig.getColumnStyle();
|
||||
ssb.append(safeStyle);
|
||||
ssb.textAlign(TextAlign.RIGHT);
|
||||
break;
|
||||
case INTEGER:
|
||||
columnConfig = ColumnConfigGenerator
|
||||
.<Integer> create(columnDefinition);
|
||||
safeStyle= columnConfig.getColumnStyle();
|
||||
safeStyle = columnConfig.getColumnStyle();
|
||||
ssb.append(safeStyle);
|
||||
ssb.textAlign(TextAlign.RIGHT);
|
||||
break;
|
||||
case LONG:
|
||||
columnConfig = ColumnConfigGenerator
|
||||
.<Long> create(columnDefinition);
|
||||
safeStyle= columnConfig.getColumnStyle();
|
||||
safeStyle = columnConfig.getColumnStyle();
|
||||
ssb.append(safeStyle);
|
||||
ssb.textAlign(TextAlign.RIGHT);
|
||||
break;
|
||||
case GEOMETRY:
|
||||
columnConfig = ColumnConfigGenerator
|
||||
.<String> create(columnDefinition);
|
||||
safeStyle= columnConfig.getColumnStyle();
|
||||
safeStyle = columnConfig.getColumnStyle();
|
||||
ssb.append(safeStyle);
|
||||
break;
|
||||
case STRING:
|
||||
columnConfig = ColumnConfigGenerator
|
||||
.<String> create(columnDefinition);
|
||||
safeStyle= columnConfig.getColumnStyle();
|
||||
safeStyle = columnConfig.getColumnStyle();
|
||||
ssb.append(safeStyle);
|
||||
break;
|
||||
default:
|
||||
|
@ -148,14 +147,17 @@ public class ColumnConfigGenerator {
|
|||
+ SafeHtmlUtils.htmlEscape(columnDefinition.getLabel())
|
||||
+ "</bold><BR>"
|
||||
+ "<em style='text-decoration:underline;'>"
|
||||
+ SafeHtmlUtils.htmlEscape(columnDefinition.getColumnTypeName())
|
||||
+ SafeHtmlUtils.htmlEscape(columnDefinition
|
||||
.getColumnTypeName())
|
||||
+ "</em><bold>"
|
||||
+ SafeHtmlUtils.htmlEscape(local)
|
||||
+ "</bold><BR>"
|
||||
+ "<em>"
|
||||
+ SafeHtmlUtils.htmlEscape(columnDefinition.getColumnDataType())
|
||||
+ SafeHtmlUtils.htmlEscape(columnDefinition
|
||||
.getColumnDataType())
|
||||
+ "</em><BR>"
|
||||
+ SafeHtmlUtils.htmlEscape(columnDefinition.getTooltipMessage()) + "</p>");
|
||||
+ SafeHtmlUtils.htmlEscape(columnDefinition
|
||||
.getTooltipMessage()) + "</p>");
|
||||
columnConfig.setToolTip(tooltipMessage.toSafeHtml());
|
||||
|
||||
return columnConfig;
|
||||
|
@ -196,13 +198,7 @@ public class ColumnConfigGenerator {
|
|||
new NumberField<Double>(
|
||||
new NumberPropertyEditor.DoublePropertyEditor()));
|
||||
break;
|
||||
case FLOAT:
|
||||
editableGrid
|
||||
.addEditor(
|
||||
(ColumnConfig<DataRow, Float>) columnConfig,
|
||||
new NumberField<Float>(
|
||||
new NumberPropertyEditor.FloatPropertyEditor()));
|
||||
break;
|
||||
|
||||
case INTEGER:
|
||||
editableGrid
|
||||
.addEditor(
|
||||
|
|
|
@ -151,16 +151,7 @@ public class GridJSonBuilder {
|
|||
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.
|
||||
|
|
|
@ -138,17 +138,7 @@ public class GridJSonWriter {
|
|||
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.
|
||||
|
|
|
@ -15,7 +15,6 @@ public enum ValueType implements Serializable {
|
|||
STRING,
|
||||
INTEGER,
|
||||
BOOLEAN,
|
||||
FLOAT,
|
||||
DOUBLE,
|
||||
LONG,
|
||||
DATE,
|
||||
|
|
|
@ -27,7 +27,7 @@ public class TestGridJSonBuilder {
|
|||
gridJSonWriter.addValue("boolean", false);
|
||||
gridJSonWriter.addValue("date", new Date(1));
|
||||
gridJSonWriter.addValue("double", 2.1);
|
||||
gridJSonWriter.addValue("float", 2.3f);
|
||||
//gridJSonWriter.addValue("float", 2.3f);
|
||||
gridJSonWriter.addValue("long", 123l);
|
||||
gridJSonWriter.addValue("string", "This is a string");
|
||||
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("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("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("string", "string", "string", ValueType.STRING, 1, true, true, ColumnType.USER));
|
||||
|
||||
|
@ -72,7 +71,6 @@ public class TestSpeed {
|
|||
tableJSonWriter.addValue("boolean", false);
|
||||
tableJSonWriter.addValue("date", new Date(1));
|
||||
tableJSonWriter.addValue("double", 2.1);
|
||||
tableJSonWriter.addValue("float", 2.3f);
|
||||
tableJSonWriter.addValue("long", 123l);
|
||||
tableJSonWriter.addValue("string", "This is a string");
|
||||
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("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("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("string", "string", "string", ValueType.STRING, 1, true, true, ColumnType.USER));
|
||||
|
||||
|
@ -115,7 +112,6 @@ public class TestSpeed {
|
|||
gridJSonWriter.addValue("boolean", false);
|
||||
gridJSonWriter.addValue("date", new Date(1));
|
||||
gridJSonWriter.addValue("double", 2.1);
|
||||
gridJSonWriter.addValue("float", 2.3f);
|
||||
gridJSonWriter.addValue("long", 123l);
|
||||
gridJSonWriter.addValue("string", "This is a string");
|
||||
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("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("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("string", "string", "string", ValueType.STRING, 1, true, true, ColumnType.USER));
|
||||
|
||||
|
@ -40,7 +39,6 @@ public class TestTableJSonBuilder {
|
|||
gridJSonWriter.addValue("boolean", false);
|
||||
gridJSonWriter.addValue("date", new Date(1));
|
||||
gridJSonWriter.addValue("double", 2.1);
|
||||
gridJSonWriter.addValue("float", 2.3f);
|
||||
gridJSonWriter.addValue("long", 123l);
|
||||
gridJSonWriter.addValue("string", "This is a string");
|
||||
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("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("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("string", "string", "string", ValueType.STRING, 1, true, true, ColumnType.USER));
|
||||
|
||||
|
@ -50,7 +49,6 @@ public class TestTableJSonWriter {
|
|||
tableJSonWriter.addValue("boolean", false);
|
||||
tableJSonWriter.addValue("date", new Date(1));
|
||||
tableJSonWriter.addValue("double", 2.1);
|
||||
tableJSonWriter.addValue("float", 2.3f);
|
||||
tableJSonWriter.addValue("long", 123l);
|
||||
tableJSonWriter.addValue("string", "This is a string");
|
||||
tableJSonWriter.endRow();
|
||||
|
|
Loading…
Reference in New Issue