+ /**
+ * Get the number of lines in the underlying Document.
+ *
+ * @return the number of lines
+ */
+ public int getLineCount() {
+ return document.getLineCount();
+ }
+
+ /**
+ * Get the current visible top row number. 1-based.
+ *
+ * @return the visible top row number. Row 1 is the first row.
+ */
+ public int getVisibleRowNumber() {
+ return topLine + 1;
+ }
+
+ /**
+ * Set the current visible row number. 1-based.
+ *
+ * @param row the new visible row number. Row 1 is the first row.
+ */
+ public void setVisibleRowNumber(final int row) {
+ assert (row > 0);
+ if ((row > 0) && (row < document.getLineCount())) {
+ topLine = row - 1;
+ alignDocument(true);
+ }
+ }
+
+ /**
+ * Get the current editing row number. 1-based.
+ *
+ * @return the editing row number. Row 1 is the first row.
+ */
+ public int getEditingRowNumber() {
+ return document.getLineNumber() + 1;
+ }
+
+ /**
+ * Set the current editing row number. 1-based.
+ *
+ * @param row the new editing row number. Row 1 is the first row.
+ */
+ public void setEditingRowNumber(final int row) {
+ assert (row > 0);
+ if ((row > 0) && (row < document.getLineCount())) {
+ document.setLineNumber(row - 1);
+ alignTopLine(true);
+ }
+ }
+
+ /**
+ * Get the current editing column number. 1-based.
+ *
+ * @return the editing column number. Column 1 is the first column.
+ */
+ public int getEditingColumnNumber() {
+ return document.getCursor() + 1;
+ }
+
+ /**
+ * Set the current editing column number. 1-based.
+ *
+ * @param column the new editing column number. Column 1 is the first
+ * column.
+ */
+ public void setEditingColumnNumber(final int column) {
+ if ((column > 0) && (column < document.getLineLength())) {
+ document.setCursor(column - 1);
+ alignCursor();
+ }
+ }
+
+ /**
+ * Get the maximum possible row number. 1-based.
+ *
+ * @return the maximum row number. Row 1 is the first row.
+ */
+ public int getMaximumRowNumber() {
+ return document.getLineCount() + 1;
+ }
+
+ /**
+ * Get the maximum possible column number. 1-based.
+ *
+ * @return the maximum column number. Column 1 is the first column.
+ */
+ public int getMaximumColumnNumber() {
+ return document.getLineLengthMax() + 1;
+ }
+
+ /**
+ * Get the dirty value.
+ *
+ * @return true if the buffer is dirty
+ */
+ public boolean isDirty() {
+ return document.isDirty();
+ }
+
+ /**
+ * Save contents to file.
+ *
+ * @param filename file to save to
+ * @throws IOException if a java.io operation throws
+ */
+ public void saveToFilename(final String filename) throws IOException {
+ document.saveToFilename(filename);
+ }
+