java.lang.Object
com.vuze.plugins.mlab.tools.ndt.swingemu.StyledDocument
Emulation of javax.swing.text.StyledDocument for the NDT (Network Diagnostic Tool) plugin.
This class provides a functional document model that captures text content from the NDT tool and logs it to the I2P logging system. Unlike most components in this package, StyledDocument provides actual functionality by storing text content and forwarding it to the I2P logger.
This allows NDT test results and formatted text to be captured and logged even in headless environments without requiring an actual graphical display. The document supports text insertion and length tracking but provides no actual styling or rendering functionality.
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final LogLogger for this class.private final StringBuilderThe text held by the document.Constructor Summary
ConstructorsConstructorDescriptionThe emulated document starts as an empty StringBuilder with a logger attached;insertString(int, String, Object)is what puts text in it.Method Summary
All MethodsModifier and TypeMethodDescriptionintReturn the document length.voidinsertString(int offset, String s, Object x) Insert a string at the given offset.
Field Details
_log
Logger for this class.text
The text held by the document.
Constructor Details
StyledDocument
public StyledDocument()The emulated document starts as an empty StringBuilder with a logger attached;insertString(int, String, Object)is what puts text in it.
Method Details
getLength
public int getLength()Return the document length.- Returns:
- the number of characters appended to the document so far
insertString
Insert a string at the given offset.- Parameters:
offset- position the text is inserted at; not honored by this emulations- the text to log at the I2P warn level and append to the documentx- styling attributes; ignored by this emulation- Throws:
BadLocationException- never thrown, declared to match the Swing interface