detabbing (no functional changes)
David, you might want to check your editor settings, you're mixing tabs with spaces git-svn-id: http://google-refine.googlecode.com/svn/trunk@724 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
parent
86465c2d6f
commit
1b9cfbbf90
@ -159,13 +159,13 @@ public class GridworksServlet extends HttpServlet {
|
|||||||
final static protected long s_autoSavePeriod = 1000 * 60 * 5; // 5 minutes
|
final static protected long s_autoSavePeriod = 1000 * 60 * 5; // 5 minutes
|
||||||
static protected class AutoSaveTimerTask extends TimerTask {
|
static protected class AutoSaveTimerTask extends TimerTask {
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
ProjectManager.singleton.save(false); // quick, potentially incomplete save
|
ProjectManager.singleton.save(false); // quick, potentially incomplete save
|
||||||
} finally {
|
} finally {
|
||||||
_timer.schedule(new AutoSaveTimerTask(), s_autoSavePeriod);
|
_timer.schedule(new AutoSaveTimerTask(), s_autoSavePeriod);
|
||||||
// we don't use scheduleAtFixedRate because that might result in
|
// we don't use scheduleAtFixedRate because that might result in
|
||||||
// bunched up events when the computer is put in sleep mode
|
// bunched up events when the computer is put in sleep mode
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -178,7 +178,7 @@ public class GridworksServlet extends HttpServlet {
|
|||||||
|
|
||||||
if (_timer == null) {
|
if (_timer == null) {
|
||||||
_timer = new Timer("autosave");
|
_timer = new Timer("autosave");
|
||||||
_timer.schedule(new AutoSaveTimerTask(), s_autoSavePeriod);
|
_timer.schedule(new AutoSaveTimerTask(), s_autoSavePeriod);
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.trace("< initialize");
|
logger.trace("< initialize");
|
||||||
|
@ -145,23 +145,23 @@ public class ProjectManager {
|
|||||||
* APPDATA value to substitute back the original user ID.
|
* APPDATA value to substitute back the original user ID.
|
||||||
*/
|
*/
|
||||||
static protected String fixWindowsUnicodePath(String path) {
|
static protected String fixWindowsUnicodePath(String path) {
|
||||||
int q = path.indexOf('?');
|
int q = path.indexOf('?');
|
||||||
if (q < 0) {
|
if (q < 0) {
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
int pathSep = path.indexOf(File.separatorChar, q);
|
int pathSep = path.indexOf(File.separatorChar, q);
|
||||||
|
|
||||||
String goodPath = System.getenv("APPDATA");
|
String goodPath = System.getenv("APPDATA");
|
||||||
if (goodPath == null || goodPath.length() == 0) {
|
if (goodPath == null || goodPath.length() == 0) {
|
||||||
goodPath = System.getenv("USERPROFILE");
|
goodPath = System.getenv("USERPROFILE");
|
||||||
if (!goodPath.endsWith(File.separator)) {
|
if (!goodPath.endsWith(File.separator)) {
|
||||||
goodPath = goodPath + File.separator;
|
goodPath = goodPath + File.separator;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int goodPathSep = goodPath.indexOf(File.separatorChar, q);
|
int goodPathSep = goodPath.indexOf(File.separatorChar, q);
|
||||||
|
|
||||||
return path.substring(0, q) + goodPath.substring(q, goodPathSep) + path.substring(pathSep);
|
return path.substring(0, q) + goodPath.substring(q, goodPathSep) + path.substring(pathSep);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ProjectManager(File dir) {
|
private ProjectManager(File dir) {
|
||||||
@ -291,13 +291,13 @@ public class ProjectManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setBusy(boolean busy) {
|
public void setBusy(boolean busy) {
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
if (busy) {
|
if (busy) {
|
||||||
_busy++;
|
_busy++;
|
||||||
} else {
|
} else {
|
||||||
_busy--;
|
_busy--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addLatestExpression(String s) {
|
public void addLatestExpression(String s) {
|
||||||
@ -315,10 +315,10 @@ public class ProjectManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void save(boolean allModified) {
|
public void save(boolean allModified) {
|
||||||
if (allModified || _busy == 0) {
|
if (allModified || _busy == 0) {
|
||||||
saveProjects(allModified);
|
saveProjects(allModified);
|
||||||
saveWorkspace();
|
saveWorkspace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -67,16 +67,16 @@ public class ScatterplotDrawingRowVisitor implements RowVisitor {
|
|||||||
g2.setPaint(color);
|
g2.setPaint(color);
|
||||||
|
|
||||||
if (r != null) {
|
if (r != null) {
|
||||||
/*
|
/*
|
||||||
* Fill in the negative quadrants to give a hint of how the plot has been rotated.
|
* Fill in the negative quadrants to give a hint of how the plot has been rotated.
|
||||||
*/
|
*/
|
||||||
Graphics2D g2r = (Graphics2D) g2.create();
|
Graphics2D g2r = (Graphics2D) g2.create();
|
||||||
g2r.transform(r);
|
g2r.transform(r);
|
||||||
|
|
||||||
g2r.setPaint(Color.lightGray);
|
g2r.setPaint(Color.lightGray);
|
||||||
g2r.fillRect(-size, 0, size, size);
|
g2r.fillRect(-size, 0, size, size);
|
||||||
g2r.fillRect(0, -size, size, size);
|
g2r.fillRect(0, -size, size, size);
|
||||||
g2r.dispose();
|
g2r.dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,7 +97,7 @@ public class ScatterplotDrawingRowVisitor implements RowVisitor {
|
|||||||
Point2D.Double p = new Point2D.Double(xv,yv);
|
Point2D.Double p = new Point2D.Double(xv,yv);
|
||||||
|
|
||||||
p = ScatterplotFacet.translateCoordinates(
|
p = ScatterplotFacet.translateCoordinates(
|
||||||
p, min_x, max_x, min_y, max_y, dim_x, dim_y, l, r);
|
p, min_x, max_x, min_y, max_y, dim_x, dim_y, l, r);
|
||||||
|
|
||||||
g2.fill(new Rectangle2D.Double(p.x - dot / 2, p.y - dot / 2, dot, dot));
|
g2.fill(new Rectangle2D.Double(p.x - dot / 2, p.y - dot / 2, dot, dot));
|
||||||
}
|
}
|
||||||
|
@ -175,8 +175,8 @@ public class ScatterplotFacet implements Facet {
|
|||||||
to_x = o.getDouble(TO_X);
|
to_x = o.getDouble(TO_X);
|
||||||
selected = true;
|
selected = true;
|
||||||
} else {
|
} else {
|
||||||
from_x = 0;
|
from_x = 0;
|
||||||
to_x = 1;
|
to_x = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
dim_y = (o.has(DIM_Y)) ? getAxisDim(o.getString(DIM_Y)) : LIN;
|
dim_y = (o.has(DIM_Y)) ? getAxisDim(o.getString(DIM_Y)) : LIN;
|
||||||
@ -185,8 +185,8 @@ public class ScatterplotFacet implements Facet {
|
|||||||
to_y = o.getDouble(TO_Y);
|
to_y = o.getDouble(TO_Y);
|
||||||
selected = true;
|
selected = true;
|
||||||
} else {
|
} else {
|
||||||
from_y = 0;
|
from_y = 0;
|
||||||
to_y = 1;
|
to_y = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
rotation = (o.has(ROTATION)) ? getRotation(o.getString(ROTATION)) : NO_ROTATION;
|
rotation = (o.has(ROTATION)) ? getRotation(o.getString(ROTATION)) : NO_ROTATION;
|
||||||
@ -251,12 +251,12 @@ public class ScatterplotFacet implements Facet {
|
|||||||
eval_y != null && errorMessage_y == null)
|
eval_y != null && errorMessage_y == null)
|
||||||
{
|
{
|
||||||
return new DualExpressionsNumberComparisonRowFilter(
|
return new DualExpressionsNumberComparisonRowFilter(
|
||||||
eval_x, columnName_x, columnIndex_x, eval_y, columnName_y, columnIndex_y) {
|
eval_x, columnName_x, columnIndex_x, eval_y, columnName_y, columnIndex_y) {
|
||||||
|
|
||||||
double from_x_pixels = from_x * l;
|
double from_x_pixels = from_x * l;
|
||||||
double to_x_pixels = to_x * l;
|
double to_x_pixels = to_x * l;
|
||||||
double from_y_pixels = from_y * l;
|
double from_y_pixels = from_y * l;
|
||||||
double to_y_pixels = to_y * l;
|
double to_y_pixels = to_y * l;
|
||||||
|
|
||||||
protected boolean checkValues(double x, double y) {
|
protected boolean checkValues(double x, double y) {
|
||||||
Point2D.Double p = new Point2D.Double(x,y);
|
Point2D.Double p = new Point2D.Double(x,y);
|
||||||
@ -348,24 +348,24 @@ public class ScatterplotFacet implements Facet {
|
|||||||
|
|
||||||
public static AffineTransform createRotationMatrix(int rotation, double l) {
|
public static AffineTransform createRotationMatrix(int rotation, double l) {
|
||||||
if (rotation == ScatterplotFacet.ROTATE_CW) {
|
if (rotation == ScatterplotFacet.ROTATE_CW) {
|
||||||
AffineTransform t = AffineTransform.getTranslateInstance(0, l / 2);
|
AffineTransform t = AffineTransform.getTranslateInstance(0, l / 2);
|
||||||
t.scale(s_rotateScale, s_rotateScale);
|
t.scale(s_rotateScale, s_rotateScale);
|
||||||
t.rotate(-Math.PI / 4);
|
t.rotate(-Math.PI / 4);
|
||||||
return t;
|
return t;
|
||||||
} else if (rotation == ScatterplotFacet.ROTATE_CCW) {
|
} else if (rotation == ScatterplotFacet.ROTATE_CCW) {
|
||||||
AffineTransform t = AffineTransform.getTranslateInstance(l / 2, 0);
|
AffineTransform t = AffineTransform.getTranslateInstance(l / 2, 0);
|
||||||
t.scale(s_rotateScale, s_rotateScale);
|
t.scale(s_rotateScale, s_rotateScale);
|
||||||
t.rotate(Math.PI / 4);
|
t.rotate(Math.PI / 4);
|
||||||
return t;
|
return t;
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Point2D.Double translateCoordinates(
|
public static Point2D.Double translateCoordinates(
|
||||||
Point2D.Double p,
|
Point2D.Double p,
|
||||||
double min_x, double max_x, double min_y, double max_y,
|
double min_x, double max_x, double min_y, double max_y,
|
||||||
int dim_x, int dim_y, double l, AffineTransform t) {
|
int dim_x, int dim_y, double l, AffineTransform t) {
|
||||||
|
|
||||||
double x = p.x;
|
double x = p.x;
|
||||||
double y = p.y;
|
double y = p.y;
|
||||||
@ -389,7 +389,7 @@ public class ScatterplotFacet implements Facet {
|
|||||||
p.x = x;
|
p.x = x;
|
||||||
p.y = y;
|
p.y = y;
|
||||||
if (t != null) {
|
if (t != null) {
|
||||||
t.transform(p, p);
|
t.transform(p, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
return p;
|
return p;
|
||||||
|
@ -62,7 +62,7 @@ public class CreateProjectCommand extends Command {
|
|||||||
public void doPost(HttpServletRequest request, HttpServletResponse response)
|
public void doPost(HttpServletRequest request, HttpServletResponse response)
|
||||||
throws ServletException, IOException {
|
throws ServletException, IOException {
|
||||||
|
|
||||||
ProjectManager.singleton.setBusy(true);
|
ProjectManager.singleton.setBusy(true);
|
||||||
try {
|
try {
|
||||||
/*
|
/*
|
||||||
* The uploaded file is in the POST body as a "file part". If
|
* The uploaded file is in the POST body as a "file part". If
|
||||||
@ -99,7 +99,7 @@ public class CreateProjectCommand extends Command {
|
|||||||
);
|
);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} finally {
|
} finally {
|
||||||
ProjectManager.singleton.setBusy(false);
|
ProjectManager.singleton.setBusy(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ public class ImportProjectCommand extends Command {
|
|||||||
public void doPost(HttpServletRequest request, HttpServletResponse response)
|
public void doPost(HttpServletRequest request, HttpServletResponse response)
|
||||||
throws ServletException, IOException {
|
throws ServletException, IOException {
|
||||||
|
|
||||||
ProjectManager.singleton.setBusy(true);
|
ProjectManager.singleton.setBusy(true);
|
||||||
try {
|
try {
|
||||||
Properties options = ParsingUtilities.parseUrlParameters(request);
|
Properties options = ParsingUtilities.parseUrlParameters(request);
|
||||||
|
|
||||||
@ -65,7 +65,7 @@ public class ImportProjectCommand extends Command {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} finally {
|
} finally {
|
||||||
ProjectManager.singleton.setBusy(false);
|
ProjectManager.singleton.setBusy(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ public class UploadDataCommand extends Command {
|
|||||||
public void doPost(HttpServletRequest request, HttpServletResponse response)
|
public void doPost(HttpServletRequest request, HttpServletResponse response)
|
||||||
throws ServletException, IOException {
|
throws ServletException, IOException {
|
||||||
|
|
||||||
ProjectManager.singleton.setBusy(true);
|
ProjectManager.singleton.setBusy(true);
|
||||||
try {
|
try {
|
||||||
Project project = getProject(request);
|
Project project = getProject(request);
|
||||||
Engine engine = getEngine(request, project);
|
Engine engine = getEngine(request, project);
|
||||||
@ -51,7 +51,7 @@ public class UploadDataCommand extends Command {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
respondException(response, e);
|
respondException(response, e);
|
||||||
} finally {
|
} finally {
|
||||||
ProjectManager.singleton.setBusy(false);
|
ProjectManager.singleton.setBusy(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ public class ExportRowsCommand extends Command {
|
|||||||
public void doPost(HttpServletRequest request, HttpServletResponse response)
|
public void doPost(HttpServletRequest request, HttpServletResponse response)
|
||||||
throws ServletException, IOException {
|
throws ServletException, IOException {
|
||||||
|
|
||||||
ProjectManager.singleton.setBusy(true);
|
ProjectManager.singleton.setBusy(true);
|
||||||
try {
|
try {
|
||||||
Project project = getProject(request);
|
Project project = getProject(request);
|
||||||
Engine engine = getEngine(request, project);
|
Engine engine = getEngine(request, project);
|
||||||
@ -56,7 +56,7 @@ public class ExportRowsCommand extends Command {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
respondException(response, e);
|
respondException(response, e);
|
||||||
} finally {
|
} finally {
|
||||||
ProjectManager.singleton.setBusy(false);
|
ProjectManager.singleton.setBusy(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -151,19 +151,19 @@ public class GetScatterplotCommand extends Command {
|
|||||||
size, dim_x, dim_y, rotation, dot, color
|
size, dim_x, dim_y, rotation, dot, color
|
||||||
);
|
);
|
||||||
|
|
||||||
if (base_color != null) {
|
if (base_color != null) {
|
||||||
drawer.setColor(base_color);
|
drawer.setColor(base_color);
|
||||||
|
|
||||||
FilteredRows filteredRows = engine.getAllRows();
|
FilteredRows filteredRows = engine.getAllRows();
|
||||||
filteredRows.accept(project, drawer);
|
filteredRows.accept(project, drawer);
|
||||||
|
|
||||||
drawer.setColor(color);
|
drawer.setColor(color);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
FilteredRows filteredRows = engine.getAllFilteredRows(false);
|
FilteredRows filteredRows = engine.getAllFilteredRows(false);
|
||||||
filteredRows.accept(project, drawer);
|
filteredRows.accept(project, drawer);
|
||||||
}
|
}
|
||||||
|
|
||||||
ImageIO.write(drawer.getImage(), "png", output);
|
ImageIO.write(drawer.getImage(), "png", output);
|
||||||
} else {
|
} else {
|
||||||
|
@ -28,13 +28,13 @@ public class CSVRowParser extends RowParser {
|
|||||||
if (quote < 0) {
|
if (quote < 0) {
|
||||||
sb.append(line.substring(start));
|
sb.append(line.substring(start));
|
||||||
|
|
||||||
start = 0;
|
start = 0;
|
||||||
try {
|
try {
|
||||||
line = lineReader.readLine();
|
line = lineReader.readLine();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
line = "";
|
line = "";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (quote < line.length() - 1 && line.charAt(quote + 1) == '"') {
|
if (quote < line.length() - 1 && line.charAt(quote + 1) == '"') {
|
||||||
sb.append(line.substring(start, quote + 1)); // include " as well
|
sb.append(line.substring(start, quote + 1)); // include " as well
|
||||||
|
@ -141,9 +141,9 @@ public class Recon implements HasFields, Jsonizable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Object getField(String name, Properties bindings) {
|
public Object getField(String name, Properties bindings) {
|
||||||
if ("id".equals(name)) {
|
if ("id".equals(name)) {
|
||||||
return id;
|
return id;
|
||||||
} else if ("best".equals(name)) {
|
} else if ("best".equals(name)) {
|
||||||
return candidates != null && candidates.size() > 0 ? candidates.get(0) : null;
|
return candidates != null && candidates.size() > 0 ? candidates.get(0) : null;
|
||||||
} else if ("candidates".equals(name)) {
|
} else if ("candidates".equals(name)) {
|
||||||
return candidates;
|
return candidates;
|
||||||
|
@ -49,7 +49,7 @@ public class MassChange implements Change {
|
|||||||
writer.write("updateRowContextDependencies="); writer.write(Boolean.toString(_updateRowContextDependencies)); writer.write('\n');
|
writer.write("updateRowContextDependencies="); writer.write(Boolean.toString(_updateRowContextDependencies)); writer.write('\n');
|
||||||
writer.write("changeCount="); writer.write(Integer.toString(_changes.size())); writer.write('\n');
|
writer.write("changeCount="); writer.write(Integer.toString(_changes.size())); writer.write('\n');
|
||||||
for (Change c : _changes) {
|
for (Change c : _changes) {
|
||||||
History.writeOneChange(writer, c, options);
|
History.writeOneChange(writer, c, options);
|
||||||
}
|
}
|
||||||
writer.write("/ec/\n"); // end of change marker
|
writer.write("/ec/\n"); // end of change marker
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ public class Link implements Jsonizable {
|
|||||||
writer.key("property"); property.write(writer, options);
|
writer.key("property"); property.write(writer, options);
|
||||||
if (target != null) {
|
if (target != null) {
|
||||||
writer.key("target");
|
writer.key("target");
|
||||||
target.write(writer, options);
|
target.write(writer, options);
|
||||||
}
|
}
|
||||||
writer.endObject();
|
writer.endObject();
|
||||||
}
|
}
|
||||||
|
@ -93,7 +93,7 @@ public class Protograph implements Jsonizable {
|
|||||||
node2.addLink(new Link(
|
node2.addLink(new Link(
|
||||||
reconstructProperty(oLink.getJSONObject("property")),
|
reconstructProperty(oLink.getJSONObject("property")),
|
||||||
oLink.has("target") && !oLink.isNull("target") ?
|
oLink.has("target") && !oLink.isNull("target") ?
|
||||||
reconstructNode(oLink.getJSONObject("target")) : null
|
reconstructNode(oLink.getJSONObject("target")) : null
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user