Search in sources :

Example 1 with CommentContainer

use of com.google.security.zynamics.binnavi.ZyGraph.Builders.CommentContainer in project binnavi by google.

the class TypeInstanceTableDatamodel method generateFormattedComment.

private static FormattedCharacterBuffer generateFormattedComment(final List<IComment> comments) {
    // Calculate the number of rows that will be needed.
    int numberOfRows = 0;
    for (final IComment comment : comments) {
        final CommentContainer commentContainer = new CommentContainer(comment);
        final List<String> commentFragments = commentContainer.getCommentingString();
        numberOfRows += commentFragments.size();
    }
    // Generate and fill the buffer.
    FormattedCharacterBuffer result = new FormattedCharacterBuffer(numberOfRows + 1, columns[COMMENTS_INDEX].getWidth());
    int lineIndex = 0;
    int columnIndex = 0;
    for (final IComment comment : comments) {
        final CommentContainer commentContainer = new CommentContainer(comment);
        final List<String> commentFragments = commentContainer.getCommentingString();
        for (final String commentFragment : commentFragments) {
            for (int i = 0; i < commentFragment.length(); i++) {
                result.setAt(lineIndex, columnIndex, commentFragment.charAt(i), STANDARD_FONT, Color.BLACK, Color.WHITE);
                columnIndex++;
            }
            columnIndex = 0;
            lineIndex++;
        }
    }
    return result;
}
Also used : IComment(com.google.security.zynamics.binnavi.Gui.GraphWindows.CommentDialogs.Interfaces.IComment) CommentContainer(com.google.security.zynamics.binnavi.ZyGraph.Builders.CommentContainer) FormattedCharacterBuffer(com.google.security.zynamics.zylib.gui.CodeDisplay.FormattedCharacterBuffer)

Aggregations

IComment (com.google.security.zynamics.binnavi.Gui.GraphWindows.CommentDialogs.Interfaces.IComment)1 CommentContainer (com.google.security.zynamics.binnavi.ZyGraph.Builders.CommentContainer)1 FormattedCharacterBuffer (com.google.security.zynamics.zylib.gui.CodeDisplay.FormattedCharacterBuffer)1