java.lang.Object
com.vuze.plugins.mlab.tools.ndt.swingemu.StyledDocument

public class StyledDocumentextends Object
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 Details

    • _log

      private final Log _log
      Logger for this class.
    • text

      private final StringBuilder 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

      public void insertString(int offset, String s, Object x) throws BadLocationException
      Insert a string at the given offset.
      Parameters:
      offset - position the text is inserted at; not honored by this emulation
      s - the text to log at the I2P warn level and append to the document
      x - styling attributes; ignored by this emulation
      Throws:
      BadLocationException - never thrown, declared to match the Swing interface