Merge pull request #9 from OpenRefine/master

Merge with master project
This commit is contained in:
Fabio 2014-04-30 14:21:00 +02:00
commit 88d1317b29
6 changed files with 11 additions and 44 deletions

View File

@ -37,7 +37,7 @@ final class FusionTableSerializer implements TabularSerializer {
@Override
public void endFile() {
if (sbBatch != null) {
sendBatch();
sendBatch(true);
}
}
@ -61,14 +61,14 @@ final class FusionTableSerializer implements TabularSerializer {
formatCsv(cells, sbBatch);
rows++;
if (rows % BATCH_SIZE == 0) {
if (!sendBatch()) {
if (!sendBatch(false)) {
return;
}
}
}
}
private boolean sendBatch() {
private boolean sendBatch(boolean isLastChunk) {
try {
// FIXME: text/csv doesn't work even though that's what the content is
AbstractInputStreamContent content = ByteArrayContent.fromString("application/octet-stream", sbBatch.toString());
@ -77,8 +77,9 @@ final class FusionTableSerializer implements TabularSerializer {
// // TODO: we really want to do GZIP compression here
// new ByteArrayInputStream(sbBatch.toString().getBytes("UTF-8")));
Long count = FusionTableHandler.insertRows(service, tableId, content);
if (count != BATCH_SIZE) {
exceptions.add(new IOException("only imported %d of %d rows"));
if (!isLastChunk && count != BATCH_SIZE) {
// FIXME: this message should say numbers instead of %d but we'd need to know the batch number for this
exceptions.add(new IOException("Only imported %d of %d rows"));
}
} catch (IOException e) {
exceptions.add(e);
@ -153,4 +154,4 @@ final class FusionTableSerializer implements TabularSerializer {
return tableId == null || exceptions.size() > 0 ? null :
"https://www.google.com/fusiontables/DataSource?docid=" + tableId;
}
}
}

View File

@ -102,6 +102,7 @@ public class XlsExporter implements StreamExporter {
Cell c = r.createCell(i);
if (i == 255 && cells.size() > 256) {
c.setCellValue("ERROR: TOO MANY COLUMNS");
break;
} else {
CellData cellData = cells.get(i);

View File

@ -110,7 +110,7 @@ public class ImportingManager {
static private ScheduledExecutorService service;
final static private long TIMER_PERIOD = 10; // 10 minutes
final static private long STALE_PERIOD = 60; // 60 minutes
final static private long STALE_PERIOD = 60 * 60 * 1000; // 60 minutes in milliseconds
static private class CleaningTimerTask implements Runnable {
@Override

View File

@ -118,9 +118,6 @@ ExpressionPreviewDialog.Widget = function(
this._timerID = null;
$("#expression-preview-tabs").tabs();
$("#expression-preview-tabs-history").css("display", "");
$("#expression-preview-tabs-starred").css("display", "");
$("#expression-preview-tabs-help").css("display", "");
this._elmts.expressionPreviewLanguageSelect[0].value = language;
this._elmts.expressionPreviewLanguageSelect.bind("change", function() {
@ -461,4 +458,4 @@ ExpressionPreviewDialog.Widget.prototype._renderPreview = function(expression, d
renderValue(tdValue, v);
}
}
};
};

Binary file not shown.

View File

@ -461,44 +461,12 @@ class RefineClient extends JFrame implements ActionListener {
final static Logger logger = LoggerFactory.getLogger("refine-client");
public static boolean MACOSX = (System.getProperty("os.name").toLowerCase().startsWith("mac os x"));
private URI uri;
public void init(String host, int port) throws Exception {
uri = new URI("http://" + host + ":" + port + "/");
if (MACOSX) {
// for more info on the code found here that is macosx-specific see:
// http://developer.apple.com/mac/library/documentation/Java/Conceptual/Java14Development/07-NativePlatformIntegration/NativePlatformIntegration.html
// http://developer.apple.com/mac/library/releasenotes/CrossPlatform/JavaSnowLeopardUpdate1LeopardUpdate6RN/NewandNoteworthy/NewandNoteworthy.html
JMenuBar mb = new JMenuBar();
JMenu m = new JMenu("Open");
JMenuItem mi = new JMenuItem("Open New Refine Window...");
mi.addActionListener(this);
m.add(mi);
mb.add(m);
Class<?> applicationClass = Class.forName("com.apple.eawt.Application");
Object macOSXApplication = applicationClass.getConstructor((Class[]) null).newInstance((Object[]) null);
Method setDefaultMenuBar = applicationClass.getDeclaredMethod("setDefaultMenuBar", new Class[] { JMenuBar.class });
setDefaultMenuBar.invoke(macOSXApplication, new Object[] { mb });
// FIXME(SM): this part below doesn't seem to work, I get a NPE but I have *no* idea why, suggestions?
// PopupMenu dockMenu = new PopupMenu("dock");
// MenuItem mmi = new MenuItem("Open new Refine Window...");
// mmi.addActionListener(this);
// dockMenu.add(mmi);
// this.add(dockMenu);
//
// Method setDockMenu = applicationClass.getDeclaredMethod("setDockMenu", new Class[] { PopupMenu.class });
// setDockMenu.invoke(macOSXApplication, new Object[] { dockMenu });
}
openBrowser();
}
@ -550,4 +518,4 @@ class ShutdownSignalHandler implements Runnable {
}
}