diff --git a/core/src/processing/data/Table.java b/core/src/processing/data/Table.java
index 0b8107b67..2f098c179 100644
--- a/core/src/processing/data/Table.java
+++ b/core/src/processing/data/Table.java
@@ -168,6 +168,8 @@ public class Table {
// Do this after setting types, otherwise it'll attempt to parse the
// allocated but empty rows, and drive CATEGORY columns nutso.
setRowCount(alloc);
+ // sometimes more columns than titles (and types?)
+ setColumnCount(incoming.getColumnCount());
} else if (row == alloc) {
// Far more efficient than re-allocating all columns and doing a copy
@@ -176,7 +178,14 @@ public class Table {
}
//addRow(row);
+// try {
setRow(row++, incoming);
+// } catch (ArrayIndexOutOfBoundsException aioobe) {
+// for (int i = 0; i < incoming.getColumnCount(); i++) {
+// System.out.format("[%d] %s%n", i, incoming.getString(i));
+// }
+// throw aioobe;
+// }
}
// Shrink the table to only the rows that were used
if (row != alloc) {
@@ -1034,12 +1043,18 @@ public class Table {
protected void writeCSV(PrintWriter writer) {
if (columnTitles != null) {
- for (int col = 0; col < columns.length; col++) {
+ for (int col = 0; col < getColumnCount(); col++) {
if (col != 0) {
writer.print(',');
}
- if (columnTitles[col] != null) {
- writeEntryCSV(writer, columnTitles[col]);
+ try {
+ if (columnTitles[col] != null) { // col < columnTitles.length &&
+ writeEntryCSV(writer, columnTitles[col]);
+ }
+ } catch (ArrayIndexOutOfBoundsException e) {
+ PApplet.printArray(columnTitles);
+ PApplet.printArray(columns);
+ throw e;
}
}
writer.println();
@@ -1110,13 +1125,24 @@ public class Table {
writer.println("
");
writer.println(" ");
+
+ if (hasColumnTitles()) {
+ writer.println(" ");
+ for (String entry : getColumnTitles()) {
+ writer.print(" | ");
+ writeEntryHTML(writer, entry);
+ writer.println(" | ");
+ }
+ writer.println("
");
+ }
+
for (int row = 0; row < getRowCount(); row++) {
writer.println(" ");
for (int col = 0; col < getColumnCount(); col++) {
String entry = getString(row, col);
writer.print(" | ");
writeEntryHTML(writer, entry);
- writer.println(" | ");
+ writer.println("");
}
writer.println("
");
}
@@ -1652,6 +1678,7 @@ public class Table {
}
}
+
/**
* @webref table:method
* @brief Gets the number of columns in a table
@@ -2078,7 +2105,7 @@ public class Table {
// Make sure there are enough columns to add this data
ensureBounds(row, source.getColumnCount() - 1);
- for (int col = 0; col < columns.length; col++) {
+ for (int col = 0; col < Math.min(source.getColumnCount(), columns.length); col++) {
switch (columnTypes[col]) {
case INT:
setInt(row, col, source.getInt(col));
diff --git a/core/todo.txt b/core/todo.txt
index 91b227aaa..1e13bc4fe 100644
--- a/core/todo.txt
+++ b/core/todo.txt
@@ -17,6 +17,11 @@ _ https://github.com/processing/processing/issues/3092
_ textAlign(RIGHT) including spaces at the end of each line
_ https://github.com/processing/processing/issues/3028
+_ static mode (no setup() / draw()) broken
+_ https://github.com/processing/processing/issues/3130
+_ Sketch window dimensions off in Java2D
+_ https://github.com/processing/processing/issues/3129
+
earlier
X size(640,360 , P3D) doesn't work properly
X https://github.com/processing/processing/issues/2924
@@ -31,6 +36,10 @@ data
X Add exceptions for FloatList and IntList when using add() w/o enough elements
X https://github.com/processing/processing/pull/3053
X https://github.com/processing/processing/issues/3052
+X fixes for table
+X ensure # of columns and titles lines up with Table(iterator) constructor
+X add table header to html output
+X remove extra spaces from html output
applet/sketch
X remove isGL(), is2D(), is3D(), displayable() from PApplet