Interface DocumentContext
public interface DocumentContext
Document loading context. Created by 
ViewResources and passed to ApiModule
 instances.- See Also:
 
- 
Method Summary
Modifier and TypeMethodDescription@NotNull PlayerSetGet the player the document is being opened for.@NotNull DocumentViewgetView()Get the document view.@NotNull DocumentCreate a new document.@NotNull StylesheetBuilderCreate a new style sheet builder that can be added to any document.@NotNull DocumentparseDocument(@NotNull String string) Parse a document from a string@NotNull StylesheetparseStylesheet(@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- Ifstringisnull
 - 
parseDocument
Parse a document from a stringAttempts to parse a document from a string input. If this method fails to parse the specified
string, aDelphiExceptionis thrown. Uses similar error codes toViewResources.loadDocument(String)- Parameters:
 string- Document source- Returns:
 - Parsed document
 - Throws:
 DelphiException- If the specifiedstringcould not be parsedNullPointerException- Ifstringisnull
 - 
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
 
 
 -