Oxygen XML Editor 15.0 Author API

ro.sync.document
Class DocumentPositionedInfo

java.lang.Object
  extended by ro.sync.document.DocumentPositionedInfo
Direct Known Subclasses:
AuthorDocumentPositionedInfo

@API(type=EXTENDABLE,
     src=PUBLIC)
public class DocumentPositionedInfo
extends java.lang.Object

This class holds information related to the document, refering to some errors, or find results. These informations hold the position in the document, the message and the systemId of the document in which they appear. If the systemId is null, then the semantics is that the info belongs to the currently edited file.

Since:
Jan 31, 2006, it holds severity level as well.

Field Summary
static int NOT_KNOWN
          If one of the components is not known, use this constant for it.
static int SEVERITY_ERROR
          Error message.
static int SEVERITY_FATAL
          Fatal error message.
static int SEVERITY_INFO
          Information message.
static int SEVERITY_WARN
          Warning message.
 
Constructor Summary
DocumentPositionedInfo(int offset)
          Constructor for a DPI used only to hold the current position in the editor.
DocumentPositionedInfo(int severity, ro.sync.document.MessageProvider messageProvider, java.lang.String systemID, int line, int column, int endLine, int endColumn, int length, int offset, java.net.URL additionalInfo, boolean highlightToColumn)
          Constructor.
DocumentPositionedInfo(int severity, java.lang.String message)
          Constructor.
DocumentPositionedInfo(int severity, java.lang.String message, java.lang.String systemID)
          Constructor.
DocumentPositionedInfo(int severity, java.lang.String message, java.lang.String systemID, int line, int column)
          Constructor.
DocumentPositionedInfo(int severity, java.lang.String message, java.lang.String systemID, int line, int column, int length)
          Constructor.
DocumentPositionedInfo(int severity, java.lang.String message, java.lang.String systemID, int line, int column, int length, int offset, java.net.URL additionalInfo, boolean highlightToColumn)
          Constructor.
 
Method Summary
 java.lang.String asHTML()
          Build the HTML representation of this DPI.
 java.lang.String asHTML(boolean includeSeverity, boolean includeAdditionalInfo, boolean includeDescription, boolean includeSystemID, boolean includeLocation, boolean includeOperationDescription)
          Build the HTML representation of this DPI.
 java.lang.String asText()
          Build the text representation of this DPI.
 java.lang.String asText(boolean includeSeverity, boolean includeAdditionalInfo, boolean includeDescription, boolean includeSystemID, boolean includeLocation, boolean includeOperationDescription)
          Build the text representation of this DPI.
 java.lang.String asXML()
          Build the XML representation of this DPI.
 java.lang.String asXML(boolean includeSeverity, boolean includeAdditionalInfo, boolean includeDescription, boolean includeSystemID, boolean includeLocation, boolean includeOperationDescription)
          Build the XML representation of this DPI.
 boolean equals(java.lang.Object obj)
          Indicates whether some other document positioned information is "equal to" this one.
static int flipSeverity(int severityToFlip)
          Used to obtain the severity level to be used when sorting the DPIs by severity.
protected  java.lang.String getAdditionalHtmlContent()
          Return the additional HTML content, if any.
 java.net.URL getAdditionalInfo()
          The URL for additional information if available.
 ro.sync.exml.editor.Anchor getAnchor()
          Get the error anchor if any.
 int getColumn()
          Gets the column of the event.
 ro.sync.document.DPIData getData()
          Getter for the user managed data.
 ro.sync.document.DITAAdditionalInfo getDITAAdditionalInfo()
          Additional info about DITA completeness check.
 int getEndColumn()
          Get the highlight end column, or NOT_KNOWN if not available.
 int getEndLine()
          Get the highlight end line, or NOT_KNOWN if not available.
 java.lang.String getEngineName()
          Get the name of the engine who provided the error.
 java.lang.String getImposedInitialPage()
          Get the imposed initial page if a new editor will be opened.
 int getLength()
          Gets the length of the text that will be selected in the editor.
 int getLine()
          Gets the line attribute of the event
 int[] getMatchRange()
          Get the match range if any.
 java.lang.String getMessage()
          Gets the message
 int getMessageHighlightOffset()
          Return the offset used to highlight the match inside the message in the results panel.
 ro.sync.document.MessageProvider getMessageProvider()
          The provider of messages from the current document position info.
 java.lang.String getMessageWithEngine()
          Gets the message prepended with the engine name if available.
 java.lang.String getMessageWithSeverity()
          Get the message with severity info as a char in the front of the message (W, E, F).
 int getOffset()
          Get the event's offset.
 ro.sync.document.OperationDescription getOperationDescription()
          The description of an operation (that is an operation which is applied over multiple resources) that generated this DPI.
 int getSeverity()
          Gets the severity level.
 java.lang.String getSeverityAsString()
          Gets the severity level as string
 javax.swing.text.Position[] getStartEndPositions(java.lang.String pageId)
          Get the temporary start and end positions for the current page.
 java.lang.String getSystemID()
          Gets the systemID attribute of the DocumentPositionedInfo object
 int hashCode()
          EXM-17723 - hashcode() trebuie sa fie consistent cu equals(), altfel tzapim map-urile
 boolean isHighlightToColumn()
          Check if the highlight must be made from column 0 to the specified column.
 void setAdditionalInfo(java.net.URL url)
          Set the additional information URL if available.
 void setAnchor(ro.sync.exml.editor.Anchor anchor)
          Set the error anchor.
 void setColumn(int column)
          Sets the column of the event, or NOT_KNOWN if the column is not available.
 void setData(ro.sync.document.DPIData data)
          Setter for the user managed data.
 void setDITAAdditionalInfo(ro.sync.document.DITAAdditionalInfo additionalInfo)
          Additional info about DITA completeness check.
 void setEndColumn(int endColumn)
          Sets the end column of the highlight.
 void setEndLine(int endLine)
          Sets the end line of the highlight.
 void setEngineName(java.lang.String engineName)
          Set the name of the engine who provided the error.
 void setHighlightToColumn(boolean how)
          Set highlight strategy for the document positioned information visual presentation.
 void setImposedInitialPage(java.lang.String imposedInitialPage)
          Set the imposed initial page in which to open the DPI for a new editor.
 void setLength(int length)
          Sets the length of the selected text.
 void setLine(int line)
          Sets the line of the event, or NOT_KNOWN if the line is not available.
 void setMaskPasswordsInURLs(boolean maskPasswordsInURLs)
          Set mask passwords in URLs, true by default.
 void setMatchRange(int[] matchRange)
          Set the match range.
 void setMessage(java.lang.String message)
          Sets the message.
 void setMessageHighlightOffset(int messageHighlightOffset)
          Set the offset used to highlight the match inside the message in the results panel.
 void setOffset(int offset)
          Sets the event's offset.
 void setOperationDescription(ro.sync.document.OperationDescription operationDescription)
          Sets the description of an operation (that is an operation which is applied over multiple resources) that generated this DPI.
 void setSeverity(int severity)
          Sets the error severity.
 void setSystemID(java.lang.String systemID)
          Sets the systemID of the event.
 void setTemporaryPositions(javax.swing.text.Position startPosition, javax.swing.text.Position endPosition, java.lang.String pageId)
          Set the temporary start and end positions used for keeping the DPI synchronized with the highlight range from the page.
 java.lang.String toString()
          Gets the string representation.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

SEVERITY_INFO

public static final int SEVERITY_INFO
Information message.

See Also:
Constant Field Values

SEVERITY_WARN

public static final int SEVERITY_WARN
Warning message.

See Also:
Constant Field Values

SEVERITY_ERROR

public static final int SEVERITY_ERROR
Error message.

See Also:
Constant Field Values

SEVERITY_FATAL

public static final int SEVERITY_FATAL
Fatal error message.

See Also:
Constant Field Values

NOT_KNOWN

public static final int NOT_KNOWN
If one of the components is not known, use this constant for it.

See Also:
Constant Field Values
Constructor Detail

DocumentPositionedInfo

public DocumentPositionedInfo(int offset)
Constructor for a DPI used only to hold the current position in the editor.

Parameters:
offset - Start of selection.

DocumentPositionedInfo

public DocumentPositionedInfo(int severity,
                              java.lang.String message,
                              java.lang.String systemID,
                              int line,
                              int column,
                              int length)
Constructor.

Parameters:
severity - the severity level of the message.
message - the error message.
systemID - the system ID.
line - the line on which the error occurred in the document.
column - the column on which the error occurred.
length - the length of the text to be selected.

DocumentPositionedInfo

public DocumentPositionedInfo(int severity,
                              java.lang.String message,
                              java.lang.String systemID,
                              int line,
                              int column,
                              int length,
                              int offset,
                              java.net.URL additionalInfo,
                              boolean highlightToColumn)
Constructor.

Parameters:
severity - the severity level of the message.
message - the error message.
systemID - the system ID.
line - the line on which the error occurred in the document.
column - the column on which the error occurred.
length - the length of the text to be selected.
offset - the offset in the document
additionalInfo - the URL from which the user can retrieve additional info about the error.
highlightToColumn - true if the opener must highlight the entire text from the 1 column to the column number. This is useful in case of error checks, like validations or well-formed.

DocumentPositionedInfo

public DocumentPositionedInfo(int severity,
                              ro.sync.document.MessageProvider messageProvider,
                              java.lang.String systemID,
                              int line,
                              int column,
                              int endLine,
                              int endColumn,
                              int length,
                              int offset,
                              java.net.URL additionalInfo,
                              boolean highlightToColumn)
Constructor. Uses a message provider for the cases in which composing the message takes a lot of time (e.g. XPATH).

Parameters:
severity - the severity level of the message.
messageProvider - the error message provider.
systemID - the system ID.
line - the line on which the error occurred in the document.
column - the column on which the error occurred.
endLine - the highlighted text must end in this line.
endColumn - the highlighted text must end in this column.
length - the length of the text to be selected.
offset - the offset in the document
additionalInfo - the URL from which the user can retrieve additional info about the error.
highlightToColumn - true if the opener must highlight the entire text from the 1 column to the column number. This is useful in case of error checks, like validations or well-formed.

DocumentPositionedInfo

public DocumentPositionedInfo(int severity,
                              java.lang.String message,
                              java.lang.String systemID,
                              int line,
                              int column)
Constructor.

Parameters:
severity - the severity level of the message.
message - the error message.
systemID - the system ID.
line - the line on which the error occurred in the document.
column - the column on which the error occurred.

DocumentPositionedInfo

public DocumentPositionedInfo(int severity,
                              java.lang.String message,
                              java.lang.String systemID)
Constructor.

Parameters:
severity - the severity level of the message.
message - the error message.
systemID - the system ID.

DocumentPositionedInfo

public DocumentPositionedInfo(int severity,
                              java.lang.String message)
Constructor.

Parameters:
severity - the severity level of the message.
message - the error message.
Method Detail

flipSeverity

public static int flipSeverity(int severityToFlip)
Used to obtain the severity level to be used when sorting the DPIs by severity. This is done to allow natural sorting by severity, having the SEVERITY_FATAL to be the small value and the SEVERITY_INFO the big value.

Parameters:
severityToFlip - The severity of a DPI to be translated into natural ordering.
Returns:
The natural ordering value to be used for a DPI' severity level.

equals

public boolean equals(java.lang.Object obj)
Indicates whether some other document positioned information is "equal to" this one.

Overrides:
equals in class java.lang.Object
See Also:
Object.equals(java.lang.Object)

hashCode

public int hashCode()
EXM-17723 - hashcode() trebuie sa fie consistent cu equals(), altfel tzapim map-urile

Overrides:
hashCode in class java.lang.Object
See Also:
Object.hashCode()

setSeverity

public void setSeverity(int severity)
Sets the error severity.

Parameters:
severity - The new severity value. One of: SEVERITY_INFO, SEVERITY_WARN, SEVERITY_ERROR or SEVERITY_FATAL

setColumn

public void setColumn(int column)
Sets the column of the event, or NOT_KNOWN if the column is not available.

Parameters:
column - The column

setLine

public void setLine(int line)
Sets the line of the event, or NOT_KNOWN if the line is not available.

Parameters:
line - The new line value, 1 based.

setMessage

public void setMessage(java.lang.String message)
Sets the message. It will clear any user info if there is present into the message.

Parameters:
message - The new message

setMaskPasswordsInURLs

public void setMaskPasswordsInURLs(boolean maskPasswordsInURLs)
Set mask passwords in URLs, true by default.

Parameters:
maskPasswordsInURLs - true to mask passwords in URLs which are part of the message.

setLength

public void setLength(int length)
Sets the length of the selected text.

Parameters:
length - The length of the selected text.

setSystemID

public void setSystemID(java.lang.String systemID)
Sets the systemID of the event.

Parameters:
systemID - The new systemID value

getLength

public int getLength()
Gets the length of the text that will be selected in the editor.

Returns:
The length of the text to be selected.

getColumn

public int getColumn()
Gets the column of the event.

Returns:
The column value, 1 based. Can be NOT_KNOWN.

getSeverity

public int getSeverity()
Gets the severity level. One of: SEVERITY_INFO, SEVERITY_WARN, SEVERITY_ERROR or SEVERITY_FATAL

Returns:
The severity value

getSeverityAsString

public java.lang.String getSeverityAsString()
Gets the severity level as string

Returns:
The severity value string

getLine

public int getLine()
Gets the line attribute of the event

Returns:
The line value, 1 based. Can be NOT_KNOWN.

getMessage

public java.lang.String getMessage()
Gets the message

Returns:
The message value

getMessageProvider

public ro.sync.document.MessageProvider getMessageProvider()
The provider of messages from the current document position info.

Returns:
Returns the message provider.

getMessageWithEngine

public java.lang.String getMessageWithEngine()
Gets the message prepended with the engine name if available.

Returns:
The message value

getMessageWithSeverity

public java.lang.String getMessageWithSeverity()
Get the message with severity info as a char in the front of the message (W, E, F).

Returns:
The message prefixed with the severity char. For INFO we do not present such a char.

getSystemID

public java.lang.String getSystemID()
Gets the systemID attribute of the DocumentPositionedInfo object

Returns:
The systemID value

setOffset

public void setOffset(int offset)
Sets the event's offset. can be NOT_KNOWN

Parameters:
offset - the new offset.

getOffset

public int getOffset()
Get the event's offset. Can be NOT_KNOWN

Returns:
the offset

toString

public java.lang.String toString()
Gets the string representation.

Overrides:
toString in class java.lang.Object
Returns:
the string representation.

getAdditionalInfo

public java.net.URL getAdditionalInfo()
The URL for additional information if available.

Returns:
The additional information URL, or null.

setAdditionalInfo

public void setAdditionalInfo(java.net.URL url)
Set the additional information URL if available.

Parameters:
url - The URL at which the user can find additional information.

isHighlightToColumn

public boolean isHighlightToColumn()
Check if the highlight must be made from column 0 to the specified column.

Returns:
True if the highlight must be made from column 0 to the specified column.

setHighlightToColumn

public void setHighlightToColumn(boolean how)
Set highlight strategy for the document positioned information visual presentation.

Parameters:
how - true if the visual part should highlight from column 0 to specified column false otherwise.

getEndColumn

public int getEndColumn()
Get the highlight end column, or NOT_KNOWN if not available.

Returns:
the highlight end column, or NOT_KNOWN.

getEndLine

public int getEndLine()
Get the highlight end line, or NOT_KNOWN if not available.

Returns:
the highlight end line or NOT_KNOWN.

setEndLine

public void setEndLine(int endLine)
Sets the end line of the highlight.

Parameters:
endLine - The end line of the highlight.

setEndColumn

public void setEndColumn(int endColumn)
Sets the end column of the highlight.

Parameters:
endColumn - The end column of the highlight.

setData

public void setData(ro.sync.document.DPIData data)
Setter for the user managed data.

Parameters:
data - The user managed data.

getData

public ro.sync.document.DPIData getData()
Getter for the user managed data.

Returns:
The user managed data.

setEngineName

public void setEngineName(java.lang.String engineName)
Set the name of the engine who provided the error.

Parameters:
engineName - The source engine name who provided the error.

getEngineName

public java.lang.String getEngineName()
Get the name of the engine who provided the error.

Returns:
Returns the source engine name who provided the error. null if no was engine set.

asXML

public java.lang.String asXML()
Build the XML representation of this DPI.

Returns:
The XML representation of the DPI.

asXML

public java.lang.String asXML(boolean includeSeverity,
                              boolean includeAdditionalInfo,
                              boolean includeDescription,
                              boolean includeSystemID,
                              boolean includeLocation,
                              boolean includeOperationDescription)
Build the XML representation of this DPI.

Parameters:
includeSeverity - true if severity details should be included.
includeAdditionalInfo - true if additional info details should be included.
includeDescription - true if description details should be included.
includeSystemID - true if system ID details should be included.
includeLocation - true if location details should be included.
includeOperationDescription - true if operation description details should be included.
Returns:
The XML representation of the DPI.

asText

public java.lang.String asText()
Build the text representation of this DPI. DIFFERENT from toString() !!!

Returns:
The text representation of this DPI.

asText

public java.lang.String asText(boolean includeSeverity,
                               boolean includeAdditionalInfo,
                               boolean includeDescription,
                               boolean includeSystemID,
                               boolean includeLocation,
                               boolean includeOperationDescription)
Build the text representation of this DPI. DIFFERENT from toString() !!!

Parameters:
includeSeverity - true if severity details should be included.
includeAdditionalInfo - true if additional info details should be included.
includeDescription - true if description details should be included.
includeSystemID - true if system ID details should be included.
includeLocation - true if location details should be included.
includeOperationDescription - true if operation description details should be included.
Returns:
The text representation of this DPI.

getImposedInitialPage

public java.lang.String getImposedInitialPage()
Get the imposed initial page if a new editor will be opened.

Returns:
the imposed initial page

setImposedInitialPage

public void setImposedInitialPage(java.lang.String imposedInitialPage)
Set the imposed initial page in which to open the DPI for a new editor.

Parameters:
imposedInitialPage - The imposed initial page.

getAnchor

public ro.sync.exml.editor.Anchor getAnchor()
Get the error anchor if any.

Returns:
the error anchor if any.

setAnchor

public void setAnchor(ro.sync.exml.editor.Anchor anchor)
Set the error anchor.

Parameters:
anchor - The anchor to set.

getMatchRange

public int[] getMatchRange()
Get the match range if any.

Returns:
The match range if possible.

setMatchRange

public void setMatchRange(int[] matchRange)
Set the match range.

Parameters:
matchRange - The match range.

getMessageHighlightOffset

public int getMessageHighlightOffset()
Return the offset used to highlight the match inside the message in the results panel.

Returns:
the message highlight offset.

setMessageHighlightOffset

public void setMessageHighlightOffset(int messageHighlightOffset)
Set the offset used to highlight the match inside the message in the results panel.

Parameters:
messageHighlightOffset - The offset to be set.

setOperationDescription

public void setOperationDescription(ro.sync.document.OperationDescription operationDescription)
Sets the description of an operation (that is an operation which is applied over multiple resources) that generated this DPI. Can be null.

Parameters:
operationDescription - the description of an operation (that is an operation which is applied over multiple resources) that generated this DPI. Can be null.

getOperationDescription

public ro.sync.document.OperationDescription getOperationDescription()
The description of an operation (that is an operation which is applied over multiple resources) that generated this DPI. Can be null.

Returns:
the description of an operation (that is an operation which is applied over multiple resources) that generated this DPI. Can be null.

getDITAAdditionalInfo

public ro.sync.document.DITAAdditionalInfo getDITAAdditionalInfo()
Additional info about DITA completeness check.

Returns:
Returns additional info.

setDITAAdditionalInfo

public void setDITAAdditionalInfo(ro.sync.document.DITAAdditionalInfo additionalInfo)
Additional info about DITA completeness check.

Parameters:
additionalInfo - Additional info about DITA completeness check.

setTemporaryPositions

public void setTemporaryPositions(javax.swing.text.Position startPosition,
                                  javax.swing.text.Position endPosition,
                                  java.lang.String pageId)
Set the temporary start and end positions used for keeping the DPI synchronized with the highlight range from the page.

Parameters:
startPosition - The start position.
endPosition - The end position.
pageId - The id of the page for which the positions were created, one of EditorPageConstants constants.

getStartEndPositions

public javax.swing.text.Position[] getStartEndPositions(java.lang.String pageId)
Get the temporary start and end positions for the current page.

Parameters:
pageId - The id of the page for which we want the positions, one of EditorPageConstants constants.
Returns:
An arrays with two positions, representing the start and end positions of the DPI. Can be null if the page is closed, or the DPI is not synchronized with the modifications from editor.

asHTML

public java.lang.String asHTML()
Build the HTML representation of this DPI.

Returns:
The HTML representation of this DPI.

asHTML

public java.lang.String asHTML(boolean includeSeverity,
                               boolean includeAdditionalInfo,
                               boolean includeDescription,
                               boolean includeSystemID,
                               boolean includeLocation,
                               boolean includeOperationDescription)
Build the HTML representation of this DPI.

Parameters:
includeSeverity - true if severity details should be included.
includeAdditionalInfo - true if additional info details should be included.
includeDescription - true if description details should be included.
includeSystemID - true if system ID details should be included.
includeLocation - true if location details should be included.
includeOperationDescription - true if operation description details should be included.
Returns:
The HTML representation of this DPI.

getAdditionalHtmlContent

protected java.lang.String getAdditionalHtmlContent()
Return the additional HTML content, if any.

Returns:
the additional HTML content, if any.

Oxygen XML Editor 15.0 Author API

© Copyright SyncRO Soft SRL 2002 - 2013. All rights reserved.