Package ghidra.app.util.html
Class HTMLDataTypeRepresentation
- java.lang.Object
-
- ghidra.app.util.html.HTMLDataTypeRepresentation
-
- Direct Known Subclasses:
ArrayDataTypeHTMLRepresentation,BitFieldDataTypeHTMLRepresentation,CompletelyDifferentHTMLDataTypeRepresentationWrapper,CompositeDataTypeHTMLRepresentation,DefaultDataTypeHTMLRepresentation,EnumDataTypeHTMLRepresentation,FunctionDataTypeHTMLRepresentation,MissingArchiveDataTypeHTMLRepresentation,NullDataTypeHTMLRepresentation,PointerDataTypeHTMLRepresentation,TypeDefDataTypeHTMLRepresentation
public abstract class HTMLDataTypeRepresentation extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.StringBRprotected static java.lang.StringCHARACTER_SPACEprotected static java.awt.ColorDIFF_COLORprotected static java.lang.StringELLIPSESprotected static java.lang.StringEMPTY_TAGHACK: for some reason when opening the HTML document with '/', all text until the next HTML tag is not displayed.protected static java.lang.StringEND_COMMENTprotected static java.lang.StringFORWARD_SLASHprotected static java.lang.StringHTML_CLOSEprotected static java.lang.StringHTML_OPENprotected static java.lang.StringHTML_SPACEprotected static java.lang.StringINDENT_CLOSEprotected static java.lang.StringINDENT_OPENprotected static java.lang.StringLENGTH_PREFIXprotected static intMAX_CHARACTER_LENGTHprotected static intMAX_COMPONENTSprotected static intMAX_LINE_LENGTHprotected static java.lang.StringMIDDLE_COMMENTprotected java.lang.StringoriginalHTMLDataprotected static java.lang.StringSTART_COMMENTprotected static java.lang.StringTABprotected static java.lang.StringTABLE_CLOSEprotected static java.lang.StringTABLE_OPENprotected static java.lang.StringTD_CLOSEprotected static java.lang.StringTD_OPENprotected static java.lang.StringTR_CLOSEprotected static java.lang.StringTR_OPENprotected static java.lang.StringTT_CLOSEprotected static java.lang.StringTT_OPEN
-
Constructor Summary
Constructors Modifier Constructor Description protectedHTMLDataTypeRepresentation()Default constructor for those who promise to later set the HTML textprotectedHTMLDataTypeRepresentation(java.lang.String htmlText)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected static java.lang.StringBuilderaddDataTypeLength(DataType dt, java.lang.StringBuilder buffer)protected static java.lang.StringBuilderaddDataTypeLength(java.lang.String dataTypeLengthString, java.lang.StringBuilder buffer)protected TextLinebuildFooterText(DataType dataType)protected java.util.List<ValidatableLine>buildHeaderText(DataType dataType)protected HTMLDataTypeRepresentation[]completelyDifferentDiff(HTMLDataTypeRepresentation other)protected java.util.List<ValidatableLine>copyLines(java.util.List<ValidatableLine> lines)protected static java.util.List<TextLine>createCommentLines(java.lang.String comment, int maxLines)Formats a multi-line plain-text comment as a list of HTML marked-up lines.protected PlaceHolderLinecreatePlaceHolderLine(ValidatableLine oppositeLine)Extension point for adding empty lines.abstract HTMLDataTypeRepresentation[]diff(HTMLDataTypeRepresentation otherRepresentation)Compares this representation and the given representation creates a diff string for both representations.protected voiddiffTextLine(TextLine textLine, TextLine otherTextLine)protected static java.lang.StringgetCommentForDataType(DataType dataType)Returns the plain-text value of the data type's description.protected static java.lang.StringgetDataTypeLengthString(DataType dt)protected HTMLDataTypeRepresentationDiffInputgetDiffInput(ValidatableLine line)protected HTMLDataTypeRepresentationDiffInputgetDiffInput(java.util.List<ValidatableLine> lines)java.lang.StringgetFullHTMLContentString()This is likegetHTMLString(), but does not put HTML tags around the datajava.lang.StringgetFullHTMLString()Returns an HTML string for this data representation objectjava.lang.StringgetHTMLContentString()This is likegetHTMLString(), but does not put HTML tags around the datajava.lang.StringgetHTMLString()Returns an HTML string for this data representation object.protected static DataTypegetLocatableDataType(DataType type)protected static java.lang.StringtruncateAsNecessary(java.lang.String string)protected static java.lang.StringtruncateAsNecessary(java.lang.String string, int length)protected static java.lang.StringwrapStringInColor(java.lang.String string, java.awt.Color color)
-
-
-
Field Detail
-
EMPTY_TAG
protected static final java.lang.String EMPTY_TAG
HACK: for some reason when opening the HTML document with '/', all text until the next HTML tag is not displayed. So, we put in a dummy tag and all is well. Java 1.5.0_12- See Also:
- Constant Field Values
-
MAX_COMPONENTS
protected static final int MAX_COMPONENTS
- See Also:
- Constant Field Values
-
MAX_CHARACTER_LENGTH
protected static final int MAX_CHARACTER_LENGTH
- See Also:
- Constant Field Values
-
MAX_LINE_LENGTH
protected static final int MAX_LINE_LENGTH
- See Also:
- Constant Field Values
-
HTML_OPEN
protected static final java.lang.String HTML_OPEN
- See Also:
- Constant Field Values
-
HTML_CLOSE
protected static final java.lang.String HTML_CLOSE
- See Also:
- Constant Field Values
-
HTML_SPACE
protected static final java.lang.String HTML_SPACE
- See Also:
- Constant Field Values
-
CHARACTER_SPACE
protected static final java.lang.String CHARACTER_SPACE
- See Also:
- Constant Field Values
-
TAB
protected static final java.lang.String TAB
-
BR
protected static final java.lang.String BR
- See Also:
- Constant Field Values
-
TABLE_OPEN
protected static final java.lang.String TABLE_OPEN
- See Also:
- Constant Field Values
-
TABLE_CLOSE
protected static final java.lang.String TABLE_CLOSE
- See Also:
- Constant Field Values
-
TR_OPEN
protected static final java.lang.String TR_OPEN
- See Also:
- Constant Field Values
-
TR_CLOSE
protected static final java.lang.String TR_CLOSE
- See Also:
- Constant Field Values
-
TD_OPEN
protected static final java.lang.String TD_OPEN
- See Also:
- Constant Field Values
-
TD_CLOSE
protected static final java.lang.String TD_CLOSE
- See Also:
- Constant Field Values
-
TT_OPEN
protected static final java.lang.String TT_OPEN
- See Also:
- Constant Field Values
-
TT_CLOSE
protected static final java.lang.String TT_CLOSE
- See Also:
- Constant Field Values
-
INDENT_OPEN
protected static final java.lang.String INDENT_OPEN
- See Also:
- Constant Field Values
-
INDENT_CLOSE
protected static final java.lang.String INDENT_CLOSE
- See Also:
- Constant Field Values
-
ELLIPSES
protected static final java.lang.String ELLIPSES
- See Also:
- Constant Field Values
-
LENGTH_PREFIX
protected static final java.lang.String LENGTH_PREFIX
- See Also:
- Constant Field Values
-
FORWARD_SLASH
protected static final java.lang.String FORWARD_SLASH
- See Also:
- Constant Field Values
-
START_COMMENT
protected static final java.lang.String START_COMMENT
- See Also:
- Constant Field Values
-
MIDDLE_COMMENT
protected static final java.lang.String MIDDLE_COMMENT
- See Also:
- Constant Field Values
-
END_COMMENT
protected static final java.lang.String END_COMMENT
- See Also:
- Constant Field Values
-
DIFF_COLOR
protected static final java.awt.Color DIFF_COLOR
-
originalHTMLData
protected java.lang.String originalHTMLData
-
-
Method Detail
-
addDataTypeLength
protected static java.lang.StringBuilder addDataTypeLength(java.lang.String dataTypeLengthString, java.lang.StringBuilder buffer)
-
addDataTypeLength
protected static java.lang.StringBuilder addDataTypeLength(DataType dt, java.lang.StringBuilder buffer)
-
getDataTypeLengthString
protected static java.lang.String getDataTypeLengthString(DataType dt)
-
getCommentForDataType
protected static java.lang.String getCommentForDataType(DataType dataType)
Returns the plain-text value of the data type's description.If there were html tags in the string, they are escaped.
- Parameters:
dataType- the type to get the description / comment for- Returns:
- plain-text string, w/html escaped
-
truncateAsNecessary
protected static java.lang.String truncateAsNecessary(java.lang.String string)
-
truncateAsNecessary
protected static java.lang.String truncateAsNecessary(java.lang.String string, int length)
-
wrapStringInColor
protected static java.lang.String wrapStringInColor(java.lang.String string, java.awt.Color color)
-
createCommentLines
protected static java.util.List<TextLine> createCommentLines(java.lang.String comment, int maxLines)
Formats a multi-line plain-text comment as a list of HTML marked-up lines.- Parameters:
comment- multi-line plain-text stringmaxLines- max number of formatted lines to return- Returns:
- list of html marked-up
TextLines
-
getHTMLString
public java.lang.String getHTMLString()
Returns an HTML string for this data representation object. The HTML returned will be truncated if it is too long. To get the full HTML, callgetFullHTMLString().- Returns:
- the html
- See Also:
getFullHTMLString()
-
getFullHTMLString
public java.lang.String getFullHTMLString()
Returns an HTML string for this data representation object- Returns:
- the html
- See Also:
getHTMLString()
-
getHTMLContentString
public java.lang.String getHTMLContentString()
This is likegetHTMLString(), but does not put HTML tags around the data- Returns:
- the content
-
getFullHTMLContentString
public java.lang.String getFullHTMLContentString()
This is likegetHTMLString(), but does not put HTML tags around the data- Returns:
- the content
-
diff
public abstract HTMLDataTypeRepresentation[] diff(HTMLDataTypeRepresentation otherRepresentation)
Compares this representation and the given representation creates a diff string for both representations.- Parameters:
otherRepresentation- the other representation to diff against.- Returns:
- An array of two strings: the first is this object's diff value, the second is the given objects diff value.
-
buildHeaderText
protected java.util.List<ValidatableLine> buildHeaderText(DataType dataType)
-
getDiffInput
protected HTMLDataTypeRepresentationDiffInput getDiffInput(ValidatableLine line)
-
getDiffInput
protected HTMLDataTypeRepresentationDiffInput getDiffInput(java.util.List<ValidatableLine> lines)
-
completelyDifferentDiff
protected HTMLDataTypeRepresentation[] completelyDifferentDiff(HTMLDataTypeRepresentation other)
-
copyLines
protected java.util.List<ValidatableLine> copyLines(java.util.List<ValidatableLine> lines)
-
createPlaceHolderLine
protected PlaceHolderLine createPlaceHolderLine(ValidatableLine oppositeLine)
Extension point for adding empty lines. Subclasses that do not wish to use the default empty text line can override this method.- Parameters:
oppositeLine- the line that will go along with the newly created placeholder line- Returns:
- the placeholder line
-
-