Interface DocumentContext
public interface DocumentContext
Document loading context. Created by
ViewResources
and passed to ApiModule
instances.- See Also:
-
Method Summary
Modifier and TypeMethodDescription@NotNull PlayerSet
Get the player the document is being opened for.@NotNull DocumentView
getView()
Get the document view.@NotNull Document
Create a new document.@NotNull StylesheetBuilder
Create a new style sheet builder that can be added to any document.@NotNull Document
parseDocument
(@NotNull String string) Parse a document from a string@NotNull Stylesheet
parseStylesheet
(@NotNull String string) Parse a stylesheet from a string.
-
Method Details
-
newDocument
Create a new document.The returned document's view will be set to
getView()
, but the result ofDocumentView.getDocument()
will remain null until after the module has returned the created document.- Returns:
- Created document
-
newStylesheet
Create a new style sheet builder that can be added to any document.- Returns:
- New style sheet builder
-
parseStylesheet
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
- Ifstring
isnull
-
parseDocument
Parse a document from a stringAttempts to parse a document from a string input. If this method fails to parse the specified
string
, aDelphiException
is thrown. Uses similar error codes toViewResources.loadDocument(String)
- Parameters:
string
- Document source- Returns:
- Parsed document
- Throws:
DelphiException
- If the specifiedstring
could not be parsedNullPointerException
- Ifstring
isnull
-
getPlayers
Get the player the document is being opened for.- Returns:
- Player
-
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
-