public abstract class AbstractTestScriptDocument extends DefaultStyledDocument implements TestScriptDocument
T-Plan Robot Enterprise, (C) 2009-2025 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 |
---|---|
Style |
addStyle(String nm,
Style parent) |
Map<Element,Action[]> |
getActionCache()
Get the element action cache.
|
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.
|
void |
getText(int offset,
int length,
Segment txt) |
int |
insertLineWithIndent(String line,
int offset,
boolean addNewLine,
boolean remove,
boolean after) |
void |
insertString(int offs,
String str,
AttributeSet a) |
boolean |
isAutoIndentEnabled()
Find out if auto indent is enabled.
|
void |
remove(int offs,
int len) |
void |
removeElement(Element elem) |
void |
removeStyle(String nm) |
void |
replace(int offset,
int length,
String text,
AttributeSet attrs) |
void |
setAutoIndentEnabled(boolean enabled)
Enable or disable auto indenting.
|
void |
setCharacterAttributes(int offset,
int length,
AttributeSet s,
boolean replace) |
void |
setLogicalStyle(int pos,
Style s) |
void |
setParagraphAttributes(int offset,
int length,
AttributeSet s,
boolean replace) |
static String |
suggestIndent(StyledDocument doc,
int offs) |
boolean |
supportsAutoIndent()
Find out whether the document supports auto indenting.
|
addDocumentListener, getBackground, getCharacterElement, getFont, getForeground, getLogicalStyle, getStyle, getStyleNames, removeDocumentListener
addUndoableEditListener, createPosition, dump, getAsynchronousLoadPriority, getBidiRootElement, getDocumentFilter, getDocumentListeners, getDocumentProperties, getEndPosition, getListeners, getProperty, getRootElements, getStartPosition, getUndoableEditListeners, putProperty, readLock, readUnlock, removeUndoableEditListener, render, setAsynchronousLoadPriority, setDocumentFilter, setDocumentProperties
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getSampleScriptText, isBlockEnd, resetStyles, resetStyles
addUndoableEditListener, createPosition, getEndPosition, getProperty, getRootElements, getStartPosition, putProperty, 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, boolean after) throws BadLocationException
BadLocationException
public void removeElement(Element elem)
removeElement
in class DefaultStyledDocument
public Style addStyle(String nm, Style parent)
addStyle
in interface StyledDocument
addStyle
in class DefaultStyledDocument
public void removeStyle(String nm)
removeStyle
in interface StyledDocument
removeStyle
in class DefaultStyledDocument
public void setLogicalStyle(int pos, Style s)
setLogicalStyle
in interface StyledDocument
setLogicalStyle
in class DefaultStyledDocument
public void setCharacterAttributes(int offset, int length, AttributeSet s, boolean replace)
setCharacterAttributes
in interface StyledDocument
setCharacterAttributes
in class DefaultStyledDocument
public void setParagraphAttributes(int offset, int length, AttributeSet s, boolean replace)
setParagraphAttributes
in interface StyledDocument
setParagraphAttributes
in class DefaultStyledDocument
public void remove(int offs, int len) throws BadLocationException
remove
in interface Document
remove
in class AbstractDocument
BadLocationException
public void replace(int offset, int length, String text, AttributeSet attrs) throws BadLocationException
replace
in class AbstractDocument
BadLocationException
public void getText(int offset, int length, Segment txt) throws BadLocationException
getText
in interface Document
getText
in class AbstractDocument
BadLocationException