de.netcomputing.anyj.scripting
Class AJSTextDocument

java.lang.Object
  |
  +--de.netcomputing.anyj.scripting.AJSTextDocument

public class AJSTextDocument
extends java.lang.Object

a Document opened in the editor.


Method Summary
 void centerLine(int line)
          center line 'line' in the editor
 int computeScreenColumn(int col, int line)
          computes the real column visible on the screen of a carets position (TABS get expanded)
 java.lang.String constructWhiteSpace(int col)
          constructs whitespace, replacing regions of blanks > TAB_SIZE by TABs
 void cutSelection()
          cut the current selection
 void deleteCharLeft()
          delete one character to the left
 void deleteCharRight()
          delete one character to the right
 void deleteLine(int line)
          delete line 'line'
 void deSelect()
          unselect
 void findAndSelect(java.lang.String s)
          find a String from the carets current position and select it
 char getCharacter(int col, int line)
          get the character at the given position
 int getCursorCol()
          return the carets column position
 int getCursorLine()
          return the carets line position
 java.io.File getFile()
          return the file where this document was loaded from
 java.lang.String getLine(int li)
          return the line at positioin 'li'
 int getLineCount()
          return the number of lines of this document
 int getLineLength(int li)
          return the length of the line at positioin li
 AJSTextDocument getSelection()
          return the current selection
 java.lang.String getSelectionAsString()
          return the current selection as String
 int[] getSelectionPosition()
          return the current selection as a int[] { selection start column, selection start line, selection end column, selection end line }
 boolean hasSelection()
          return wether the user has selected a string
 void hilightAll()
          run the syntaxhilighter on the whole document
 void hilightLine(int index)
          run the syntaxhilighter on line 'index'
 void insertIndent()
          insert indent (respecting AnyJ's current user settings) at the carets position (=TAB)
 void insertLine(java.lang.String line)
          insert line 'line' at the carets current position
 void insertLine(java.lang.String line, int index)
          insert line 'line' at the position idx
 void insertString(java.lang.String s)
          insert a string at the carets position
 boolean isModified()
          return wether this document contains unsaved changes
 boolean isReadOnly()
          return wether this document is Read Only
 void load(java.io.File f)
          load another file into this document
 void lockUpdate(boolean b)
          lock gui update, (useful for mass-changes).
 void moveCursorAbsolute(int x, int y, boolean doScroll)
          move the caret
 void moveToEnd()
          move the caret to the end of the document
 void moveToHome()
          move the caret to the beginning of the document
 void pasteDocument(AJSTextDocument toPaste)
          paste 'toPaste' at the caret's position
 void repaint()
          repaint all views of this document
 void save(java.io.File f)
          save this document
 void select(int colStart, int lineStart, int colEnd, int lineEnd)
          set the selection
 void setLine(java.lang.String line, int index)
          set line 'line' at the position idx
 void unInsertIndent()
          unInsert indent (respecting AnyJ's current user settings) at the carets position (=SHIFT TAB)
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getLineCount

public int getLineCount()
return the number of lines of this document

getLine

public java.lang.String getLine(int li)
return the line at positioin 'li'

getLineLength

public int getLineLength(int li)
return the length of the line at positioin li

hasSelection

public boolean hasSelection()
return wether the user has selected a string

isModified

public boolean isModified()
return wether this document contains unsaved changes

isReadOnly

public boolean isReadOnly()
return wether this document is Read Only

pasteDocument

public void pasteDocument(AJSTextDocument toPaste)
paste 'toPaste' at the caret's position

cutSelection

public void cutSelection()
cut the current selection

getSelection

public AJSTextDocument getSelection()
return the current selection

getSelectionAsString

public java.lang.String getSelectionAsString()
return the current selection as String

deSelect

public void deSelect()
unselect

getSelectionPosition

public int[] getSelectionPosition()
return the current selection as a int[] { selection start column, selection start line, selection end column, selection end line }

select

public void select(int colStart,
                   int lineStart,
                   int colEnd,
                   int lineEnd)
set the selection

findAndSelect

public void findAndSelect(java.lang.String s)
find a String from the carets current position and select it

moveToEnd

public void moveToEnd()
move the caret to the end of the document

moveToHome

public void moveToHome()
move the caret to the beginning of the document

insertIndent

public void insertIndent()
insert indent (respecting AnyJ's current user settings) at the carets position (=TAB)

constructWhiteSpace

public java.lang.String constructWhiteSpace(int col)
constructs whitespace, replacing regions of blanks > TAB_SIZE by TABs

computeScreenColumn

public int computeScreenColumn(int col,
                               int line)
computes the real column visible on the screen of a carets position (TABS get expanded)

unInsertIndent

public void unInsertIndent()
unInsert indent (respecting AnyJ's current user settings) at the carets position (=SHIFT TAB)

deleteLine

public void deleteLine(int line)
delete line 'line'

deleteCharLeft

public void deleteCharLeft()
delete one character to the left

deleteCharRight

public void deleteCharRight()
delete one character to the right

insertLine

public void insertLine(java.lang.String line)
insert line 'line' at the carets current position

insertLine

public void insertLine(java.lang.String line,
                       int index)
insert line 'line' at the position idx

hilightAll

public void hilightAll()
run the syntaxhilighter on the whole document

hilightLine

public void hilightLine(int index)
run the syntaxhilighter on line 'index'

setLine

public void setLine(java.lang.String line,
                    int index)
set line 'line' at the position idx

insertString

public void insertString(java.lang.String s)
insert a string at the carets position

save

public void save(java.io.File f)
          throws java.lang.Exception
save this document

load

public void load(java.io.File f)
load another file into this document

getFile

public java.io.File getFile()
return the file where this document was loaded from

getCursorCol

public int getCursorCol()
return the carets column position

getCursorLine

public int getCursorLine()
return the carets line position

moveCursorAbsolute

public void moveCursorAbsolute(int x,
                               int y,
                               boolean doScroll)
move the caret

repaint

public void repaint()
repaint all views of this document

lockUpdate

public void lockUpdate(boolean b)
lock gui update, (useful for mass-changes). Don't forget to unlock it.

centerLine

public void centerLine(int line)
center line 'line' in the editor

getCharacter

public char getCharacter(int col,
                         int line)
get the character at the given position