Interface DocumentContext


public interface DocumentContext
Document loading context. Created by ViewResources and passed to ApiModule instances.
See Also:
  • Method Details

    • newDocument

      @NotNull @NotNull Document newDocument()
      Create a new document.

      The returned document's view will be set to getView(), but the result of DocumentView.getDocument() will remain null until after the module has returned the created document.

      Returns:
      Created document
    • newStylesheet

      @NotNull @NotNull StylesheetBuilder newStylesheet()
      Create a new style sheet builder that can be added to any document.
      Returns:
      New style sheet builder
    • parseStylesheet

      @NotNull @NotNull Stylesheet parseStylesheet(@NotNull @NotNull String string)
      Parse a stylesheet from a string.

      This function does not throw any parsing exceptions, rather it makes it best attempt at parsing the input and logs any errors in the console.

      Parameters:
      string - Stylesheet string
      Returns:
      Parsed stylesheet
      Throws:
      NullPointerException - If string is null
    • parseDocument

      @NotNull @NotNull Document parseDocument(@NotNull @NotNull String string) throws DelphiException
      Parse a document from a string

      Attempts to parse a document from a string input. If this method fails to parse the specified string, a DelphiException is thrown. Uses similar error codes to ViewResources.loadDocument(String)

      Parameters:
      string - Document source
      Returns:
      Parsed document
      Throws:
      DelphiException - If the specified string could not be parsed
      NullPointerException - If string is null
    • getPlayers

      @NotNull @NotNull PlayerSet getPlayers()
      Get the player the document is being opened for.
      Returns:
      Player
    • getView

      @NotNull @NotNull DocumentView getView()
      Get the document view.

      The returned view will always have a null DocumentView.getDocument(), as the view's document is set after the module's load method has returned a value.

      Returns:
      Document view