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.String
BR
protected static java.lang.String
CHARACTER_SPACE
protected static java.awt.Color
DIFF_COLOR
protected static java.lang.String
ELLIPSES
protected static 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.protected static java.lang.String
END_COMMENT
protected static java.lang.String
FORWARD_SLASH
protected static java.lang.String
HTML_CLOSE
protected static java.lang.String
HTML_OPEN
protected static java.lang.String
HTML_SPACE
protected static java.lang.String
INDENT_CLOSE
protected static java.lang.String
INDENT_OPEN
protected static java.lang.String
LENGTH_PREFIX
protected static int
MAX_CHARACTER_LENGTH
protected static int
MAX_COMPONENTS
protected static int
MAX_LINE_LENGTH
protected static java.lang.String
MIDDLE_COMMENT
protected java.lang.String
originalHTMLData
protected static java.lang.String
START_COMMENT
protected static java.lang.String
TAB
protected static java.lang.String
TABLE_CLOSE
protected static java.lang.String
TABLE_OPEN
protected static java.lang.String
TD_CLOSE
protected static java.lang.String
TD_OPEN
protected static java.lang.String
TR_CLOSE
protected static java.lang.String
TR_OPEN
protected static java.lang.String
TT_CLOSE
protected static java.lang.String
TT_OPEN
-
Constructor Summary
Constructors Modifier Constructor Description protected
HTMLDataTypeRepresentation()
Default constructor for those who promise to later set the HTML textprotected
HTMLDataTypeRepresentation(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.StringBuilder
addDataTypeLength(DataType dt, java.lang.StringBuilder buffer)
protected static java.lang.StringBuilder
addDataTypeLength(java.lang.String dataTypeLengthString, java.lang.StringBuilder buffer)
protected TextLine
buildFooterText(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 PlaceHolderLine
createPlaceHolderLine(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 void
diffTextLine(TextLine textLine, TextLine otherTextLine)
protected static java.lang.String
getCommentForDataType(DataType dataType)
Returns the plain-text value of the data type's description.protected static java.lang.String
getDataTypeLengthString(DataType dt)
protected HTMLDataTypeRepresentationDiffInput
getDiffInput(ValidatableLine line)
protected HTMLDataTypeRepresentationDiffInput
getDiffInput(java.util.List<ValidatableLine> lines)
java.lang.String
getFullHTMLContentString()
This is likegetHTMLString()
, but does not put HTML tags around the datajava.lang.String
getFullHTMLString()
Returns an HTML string for this data representation objectjava.lang.String
getHTMLContentString()
This is likegetHTMLString()
, but does not put HTML tags around the datajava.lang.String
getHTMLString()
Returns an HTML string for this data representation object.protected static DataType
getLocatableDataType(DataType type)
protected static java.lang.String
truncateAsNecessary(java.lang.String string)
protected static java.lang.String
truncateAsNecessary(java.lang.String string, int length)
protected static java.lang.String
wrapStringInColor(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
TextLine
s
-
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
-
-