Better display of Calendar objects in data table view and in expression preview dialog.
git-svn-id: http://google-refine.googlecode.com/svn/trunk@208 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
parent
87d20f3299
commit
40cdf5092b
@ -2,6 +2,7 @@ package com.metaweb.gridworks.commands.util;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.Calendar;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
@ -21,6 +22,7 @@ import com.metaweb.gridworks.expr.ParsingException;
|
|||||||
import com.metaweb.gridworks.model.Cell;
|
import com.metaweb.gridworks.model.Cell;
|
||||||
import com.metaweb.gridworks.model.Project;
|
import com.metaweb.gridworks.model.Project;
|
||||||
import com.metaweb.gridworks.model.Row;
|
import com.metaweb.gridworks.model.Row;
|
||||||
|
import com.metaweb.gridworks.util.ParsingUtilities;
|
||||||
|
|
||||||
public class PreviewExpressionCommand extends Command {
|
public class PreviewExpressionCommand extends Command {
|
||||||
|
|
||||||
@ -103,8 +105,16 @@ public class PreviewExpressionCommand extends Command {
|
|||||||
writer.key("message"); writer.value(((EvalError) result).message);
|
writer.key("message"); writer.value(((EvalError) result).message);
|
||||||
writer.endObject();
|
writer.endObject();
|
||||||
} else {
|
} else {
|
||||||
if (result != null && result instanceof HasFields) {
|
if (result != null) {
|
||||||
result = "[object " + result.getClass().getSimpleName() + "]";
|
if (result instanceof HasFields) {
|
||||||
|
result = "[object " + result.getClass().getSimpleName() + "]";
|
||||||
|
} else if (result instanceof Calendar) {
|
||||||
|
Calendar c = (Calendar) result;
|
||||||
|
|
||||||
|
result = "[object " +
|
||||||
|
result.getClass().getSimpleName() + " " +
|
||||||
|
ParsingUtilities.dateToString(c.getTime()) +"]";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
writer.value(result);
|
writer.value(result);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.metaweb.gridworks.model;
|
package com.metaweb.gridworks.model;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.Calendar;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
@ -10,6 +11,7 @@ import com.metaweb.gridworks.Jsonizable;
|
|||||||
import com.metaweb.gridworks.expr.EvalError;
|
import com.metaweb.gridworks.expr.EvalError;
|
||||||
import com.metaweb.gridworks.expr.ExpressionUtils;
|
import com.metaweb.gridworks.expr.ExpressionUtils;
|
||||||
import com.metaweb.gridworks.expr.HasFields;
|
import com.metaweb.gridworks.expr.HasFields;
|
||||||
|
import com.metaweb.gridworks.util.ParsingUtilities;
|
||||||
|
|
||||||
public class Cell implements Serializable, HasFields, Jsonizable {
|
public class Cell implements Serializable, HasFields, Jsonizable {
|
||||||
private static final long serialVersionUID = -5891067829205458102L;
|
private static final long serialVersionUID = -5891067829205458102L;
|
||||||
@ -38,7 +40,11 @@ public class Cell implements Serializable, HasFields, Jsonizable {
|
|||||||
writer.value(((EvalError) value).message);
|
writer.value(((EvalError) value).message);
|
||||||
} else {
|
} else {
|
||||||
writer.key("v");
|
writer.key("v");
|
||||||
writer.value(value);
|
if (value != null && value instanceof Calendar) {
|
||||||
|
writer.value(ParsingUtilities.dateToString(((Calendar) value).getTime()));
|
||||||
|
} else {
|
||||||
|
writer.value(value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (recon != null) {
|
if (recon != null) {
|
||||||
|
Loading…
Reference in New Issue
Block a user