+ /**
+ * Get the full horizontal width of this table.
+ *
+ * @return the width required to render the entire table
+ */
+ public int getMaximumWidth() {
+ int totalWidth = 0;
+ if (showRowLabels == true) {
+ // For now, all row labels are 8 cells wide. TODO: make this
+ // adjustable.
+ totalWidth += 8;
+ }
+ for (Cell cell: getSelectedRow().cells) {
+ totalWidth += cell.getWidth() + 1;
+ }
+ return totalWidth;
+ }
+
+ /**
+ * Align the grid so that the selected cell is fully visible.
+ */
+ private void alignGrid() {
+ // Determine if we need to shift left or right.
+ int width = getMaximumWidth();
+ int leftCellX = 0;
+ if (showRowLabels == true) {
+ // For now, all row labels are 8 cells wide. TODO: make this
+ // adjustable.
+ leftCellX += 8;
+ }
+ // TODO
+
+
+ // TODO: determine shift up/down
+
+
+ }
+