2010-01-24 22:09:50 +01:00
|
|
|
package com.metaweb.gridlock.model;
|
|
|
|
|
2010-01-25 23:51:25 +01:00
|
|
|
import java.io.Serializable;
|
2010-02-03 01:20:42 +01:00
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.Map;
|
2010-01-27 02:48:42 +01:00
|
|
|
import java.util.Properties;
|
2010-01-25 23:51:25 +01:00
|
|
|
|
|
|
|
import org.json.JSONException;
|
2010-02-01 20:16:09 +01:00
|
|
|
import org.json.JSONWriter;
|
2010-01-25 23:51:25 +01:00
|
|
|
|
2010-02-01 20:16:09 +01:00
|
|
|
import com.metaweb.gridlock.Jsonizable;
|
|
|
|
|
|
|
|
public class Column implements Serializable, Jsonizable {
|
2010-01-25 23:51:25 +01:00
|
|
|
private static final long serialVersionUID = -1063342490951563563L;
|
|
|
|
|
2010-01-24 22:09:50 +01:00
|
|
|
public int cellIndex;
|
|
|
|
public String headerLabel;
|
|
|
|
public Class valueType;
|
2010-01-25 23:51:25 +01:00
|
|
|
|
2010-02-03 01:20:42 +01:00
|
|
|
transient protected Map<String, Object> _precomputes;
|
|
|
|
|
2010-02-01 20:16:09 +01:00
|
|
|
@Override
|
|
|
|
public void write(JSONWriter writer, Properties options)
|
|
|
|
throws JSONException {
|
2010-01-25 23:51:25 +01:00
|
|
|
|
2010-02-01 20:16:09 +01:00
|
|
|
writer.object();
|
|
|
|
writer.key("cellIndex"); writer.value(cellIndex);
|
|
|
|
writer.key("headerLabel"); writer.value(headerLabel);
|
|
|
|
writer.key("valueType"); writer.value(valueType == null ? null : valueType.getSimpleName());
|
|
|
|
writer.endObject();
|
2010-01-25 23:51:25 +01:00
|
|
|
}
|
2010-02-03 01:20:42 +01:00
|
|
|
|
|
|
|
public void clearPrecomputes() {
|
|
|
|
if (_precomputes != null) {
|
|
|
|
_precomputes.clear();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public Object getPrecompute(String key) {
|
|
|
|
if (_precomputes != null) {
|
|
|
|
return _precomputes.get(key);
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setPrecompute(String key, Object value) {
|
|
|
|
if (_precomputes == null) {
|
|
|
|
_precomputes = new HashMap<String, Object>();
|
|
|
|
}
|
|
|
|
_precomputes.put(key, value);
|
|
|
|
}
|
2010-01-24 22:09:50 +01:00
|
|
|
}
|