public abstract class AbstractTestScriptDocument extends DefaultStyledDocument implements TestScriptDocument
T-Plan Robot Enterprise, (C) 2009-2022 T-Plan Limited. All rights reserved.
DefaultStyledDocument.AttributeUndoableEdit, DefaultStyledDocument.ElementBuffer, DefaultStyledDocument.ElementSpec
AbstractDocument.AbstractElement, AbstractDocument.AttributeContext, AbstractDocument.BranchElement, AbstractDocument.Content, AbstractDocument.DefaultDocumentEvent, AbstractDocument.ElementEdit, AbstractDocument.LeafElement
BUFFER_SIZE_DEFAULT
BidiElementName, ContentElementName, ElementNameAttribute, ParagraphElementName, SectionElementName
StreamDescriptionProperty, TitleProperty
Constructor and Description |
---|
AbstractTestScriptDocument() |
Modifier and Type | Method and Description |
---|---|
Element |
getDefaultRootElement()
Gets the default root element (thread safe).
|
String |
getIndentUnit()
Get a single indent unit, for example a sequence of three spaces.
|
int |
getLength()
Returns the length of the data in a thread safe mode.This is the number of
characters of content that represents the users data.
|
Element |
getParagraphElement(int i)
Get the paragraph element at the offset
i (thread safe). |
static String |
getPreferredIndent()
Get the indent element based on the parameters in the configuration.
|
String |
getSuggestedIndent(int offset)
Get suggested indent for the element at the specified offset.The method
should return a sequence of white characters (spaces) which should
precede any code inserted into the line.
|
String |
getText(int offset,
int length)
Gets a sequence of text from the document in a thread safe mode.
|
int |
insertLineWithIndent(String line,
int offset,
boolean addNewLine,
boolean remove) |
void |
insertString(int offs,
String str,
AttributeSet a) |
boolean |
isAutoIndentEnabled()
Find out if auto indent is enabled.
|
void |
setAutoIndentEnabled(boolean enabled)
Enable or disable auto indenting.
|
static String |
suggestIndent(StyledDocument doc,
int offs) |
boolean |
supportsAutoIndent()
Find out whether the document supports auto indenting.
|
addDocumentListener, addStyle, getBackground, getCharacterElement, getFont, getForeground, getLogicalStyle, getStyle, getStyleNames, removeDocumentListener, removeElement, removeStyle, setCharacterAttributes, setLogicalStyle, setParagraphAttributes
addUndoableEditListener, createPosition, dump, getAsynchronousLoadPriority, getBidiRootElement, getDocumentFilter, getDocumentListeners, getDocumentProperties, getEndPosition, getListeners, getProperty, getRootElements, getStartPosition, getText, getUndoableEditListeners, putProperty, readLock, readUnlock, remove, removeUndoableEditListener, render, replace, setAsynchronousLoadPriority, setDocumentFilter, setDocumentProperties
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getSampleScriptText, isBlockEnd, resetStyles, resetStyles
addUndoableEditListener, createPosition, getEndPosition, getProperty, getRootElements, getStartPosition, getText, putProperty, remove, removeUndoableEditListener, render
public boolean supportsAutoIndent()
TestScriptDocument
Find out whether the document supports auto indenting. If the method returns true the document must support the following actions:
supportsAutoIndent
in interface TestScriptDocument
public void setAutoIndentEnabled(boolean enabled)
TestScriptDocument
setAutoIndentEnabled
in interface TestScriptDocument
enabled
- true enables auto indenting, false disables.public boolean isAutoIndentEnabled()
TestScriptDocument
isAutoIndentEnabled
in interface TestScriptDocument
public String getIndentUnit()
TestScriptDocument
getIndentUnit
in interface TestScriptDocument
public String getSuggestedIndent(int offset) throws BadLocationException
TestScriptDocument
getSuggestedIndent
in interface TestScriptDocument
offset
- a position in the document.BadLocationException
- if the offset is out of the
document bounds.public Element getParagraphElement(int i)
i
(thread safe).getParagraphElement
in interface StyledDocument
getParagraphElement
in class DefaultStyledDocument
i
- the starting offset >= 0public Element getDefaultRootElement()
getDefaultRootElement
in interface Document
getDefaultRootElement
in class DefaultStyledDocument
public String getText(int offset, int length) throws BadLocationException
getText
in interface Document
getText
in class AbstractDocument
offset
- the starting offset >= 0length
- the number of characters to retrieve >= 0BadLocationException
- the range given includes a position
that is not a valid position within the documentpublic int getLength()
getLength
in interface Document
getLength
in class AbstractDocument
public void insertString(int offs, String str, AttributeSet a) throws BadLocationException
insertString
in interface Document
insertString
in class AbstractDocument
BadLocationException
public static String getPreferredIndent()
public static String suggestIndent(StyledDocument doc, int offs) throws BadLocationException
BadLocationException
public int insertLineWithIndent(String line, int offset, boolean addNewLine, boolean remove) throws BadLocationException
BadLocationException