Class ExtendedCodeAreaPainter

    • Field Detail

      • codeArea

        @Nonnull
        protected final org.exbin.bined.swing.CodeAreaCore codeArea
      • unprintableCharactersMapping

        @Nullable
        protected java.util.Map<java.lang.Character,​java.lang.Character> unprintableCharactersMapping
    • Constructor Detail

      • ExtendedCodeAreaPainter

        public ExtendedCodeAreaPainter​(org.exbin.bined.swing.CodeAreaCore codeArea)
    • Method Detail

      • attach

        public void attach()
        Specified by:
        attach in interface org.exbin.bined.swing.CodeAreaPainter
      • detach

        public void detach()
        Specified by:
        detach in interface org.exbin.bined.swing.CodeAreaPainter
      • reset

        public void reset()
        Specified by:
        reset in interface org.exbin.bined.swing.CodeAreaPainter
      • resetColors

        public void resetColors()
        Specified by:
        resetColors in interface org.exbin.bined.swing.CodeAreaPainter
      • resetFont

        public void resetFont()
        Specified by:
        resetFont in interface org.exbin.bined.swing.CodeAreaPainter
      • resetLayout

        public void resetLayout()
        Specified by:
        resetLayout in interface org.exbin.bined.swing.CodeAreaPainter
      • resetCaret

        public void resetCaret()
        Specified by:
        resetCaret in interface org.exbin.bined.swing.CodeAreaPainter
      • rebuildColors

        public void rebuildColors()
        Specified by:
        rebuildColors in interface org.exbin.bined.swing.CodeAreaPainter
      • recomputeCharPositions

        public void recomputeCharPositions()
      • fontChanged

        public void fontChanged​(java.awt.Graphics g)
      • isInitialized

        public boolean isInitialized()
        Specified by:
        isInitialized in interface org.exbin.bined.swing.CodeAreaPainter
      • paintComponent

        public void paintComponent​(java.awt.Graphics g)
        Specified by:
        paintComponent in interface org.exbin.bined.swing.CodeAreaPainter
      • updateCache

        protected void updateCache()
      • paintOutsideArea

        public void paintOutsideArea​(java.awt.Graphics g)
      • paintHeader

        public void paintHeader​(java.awt.Graphics g)
      • paintRowPosition

        public void paintRowPosition​(java.awt.Graphics g)
      • paintMainArea

        public void paintMainArea​(java.awt.Graphics g)
        Specified by:
        paintMainArea in interface org.exbin.bined.swing.CodeAreaPainter
      • paintBackground

        public void paintBackground​(java.awt.Graphics g)
        Paints main area background.
        Parameters:
        g - graphics
      • paintRows

        public void paintRows​(java.awt.Graphics g)
      • paintRowBackground

        public void paintRowBackground​(java.awt.Graphics g,
                                       long rowDataPosition,
                                       int rowPositionX,
                                       int rowPositionY)
        Paints row background.
        Parameters:
        g - graphics
        rowDataPosition - row data position
        rowPositionX - row position X
        rowPositionY - row position Y
      • getPositionBackgroundColor

        @Nullable
        public java.awt.Color getPositionBackgroundColor​(long rowDataPosition,
                                                         int byteOnRow,
                                                         int halfCharOnRow,
                                                         org.exbin.bined.CodeAreaSection section,
                                                         boolean unprintable)
        Returns background color for particular code.
        Parameters:
        rowDataPosition - row data position
        byteOnRow - byte on current row
        halfCharOnRow - character on current row
        section - current section
        unprintable - flag for unprintable characters
        Returns:
        color or null for default color
      • computePositionScrollVisibility

        @Nonnull
        public org.exbin.bined.basic.PositionScrollVisibility computePositionScrollVisibility​(org.exbin.bined.CodeAreaCaretPosition caretPosition)
        Specified by:
        computePositionScrollVisibility in interface org.exbin.bined.swing.CodeAreaPainter
      • computeRevealScrollPosition

        @Nonnull
        public java.util.Optional<org.exbin.bined.basic.CodeAreaScrollPosition> computeRevealScrollPosition​(org.exbin.bined.CodeAreaCaretPosition caretPosition)
        Specified by:
        computeRevealScrollPosition in interface org.exbin.bined.swing.CodeAreaPainter
      • computeCenterOnScrollPosition

        @Nonnull
        public java.util.Optional<org.exbin.bined.basic.CodeAreaScrollPosition> computeCenterOnScrollPosition​(org.exbin.bined.CodeAreaCaretPosition caretPosition)
        Specified by:
        computeCenterOnScrollPosition in interface org.exbin.bined.swing.CodeAreaPainter
      • paintRowText

        public void paintRowText​(java.awt.Graphics g,
                                 long rowDataPosition,
                                 int rowPositionX,
                                 int rowPositionY)
        Paints row text.
        Parameters:
        g - graphics
        rowDataPosition - row data position
        rowPositionX - row position X
        rowPositionY - row position Y
      • getPositionTextColor

        @Nullable
        public java.awt.Color getPositionTextColor​(long rowDataPosition,
                                                   int byteOnRow,
                                                   int halfCharOnRow,
                                                   org.exbin.bined.CodeAreaSection section,
                                                   boolean unprintable)
        Returns background color for particular code.
        Parameters:
        rowDataPosition - row data position
        byteOnRow - byte on current row
        halfCharOnRow - character on current row
        section - current section
        unprintable - flag for unprintable characters
        Returns:
        color or null for default color
      • paintCursor

        public void paintCursor​(java.awt.Graphics g)
        Specified by:
        paintCursor in interface org.exbin.bined.swing.CodeAreaPainter
      • mousePositionToClosestCaretPosition

        @Nonnull
        public org.exbin.bined.CodeAreaCaretPosition mousePositionToClosestCaretPosition​(int positionX,
                                                                                         int positionY,
                                                                                         org.exbin.bined.CaretOverlapMode overflowMode)
        Specified by:
        mousePositionToClosestCaretPosition in interface org.exbin.bined.swing.CodeAreaPainter
      • computeMovePosition

        @Nonnull
        public org.exbin.bined.CodeAreaCaretPosition computeMovePosition​(org.exbin.bined.CodeAreaCaretPosition position,
                                                                         org.exbin.bined.basic.MovementDirection direction)
        Specified by:
        computeMovePosition in interface org.exbin.bined.swing.CodeAreaPainter
      • computeScrolling

        @Nonnull
        public org.exbin.bined.basic.CodeAreaScrollPosition computeScrolling​(org.exbin.bined.basic.CodeAreaScrollPosition startPosition,
                                                                             org.exbin.bined.basic.ScrollingDirection direction)
        Specified by:
        computeScrolling in interface org.exbin.bined.swing.CodeAreaPainter
      • getPositionPoint

        @Nullable
        public java.awt.Point getPositionPoint​(long dataPosition,
                                               int codeOffset,
                                               org.exbin.bined.CodeAreaSection section)
        Returns relative cursor position in code area or null if cursor is not visible.
        Parameters:
        dataPosition - data position
        codeOffset - code offset
        section - section
        Returns:
        cursor position or null
      • getMouseCursorShape

        public int getMouseCursorShape​(int positionX,
                                       int positionY)
        Specified by:
        getMouseCursorShape in interface org.exbin.bined.swing.CodeAreaPainter
      • getPositionZone

        @Nonnull
        public org.exbin.bined.basic.BasicCodeAreaZone getPositionZone​(int positionX,
                                                                       int positionY)
        Specified by:
        getPositionZone in interface org.exbin.bined.swing.CodeAreaPainter
      • drawCenteredChars

        protected void drawCenteredChars​(java.awt.Graphics g,
                                         char[] drawnChars,
                                         int charOffset,
                                         int length,
                                         int cellWidth,
                                         int positionX,
                                         int positionY)
        Draws characters centering it to cells of the same width.
        Parameters:
        g - graphics
        drawnChars - array of chars
        charOffset - index of target character in array
        length - number of characters to draw
        cellWidth - width of cell to center into
        positionX - X position of drawing area start
        positionY - Y position of drawing area start
      • drawShiftedChars

        protected void drawShiftedChars​(java.awt.Graphics g,
                                        char[] drawnChars,
                                        int charOffset,
                                        int length,
                                        int positionX,
                                        int positionY)
      • getCursorPositionRect

        @Nonnull
        public java.awt.Rectangle getCursorPositionRect​(long dataPosition,
                                                        int codeOffset,
                                                        org.exbin.bined.CodeAreaSection section)
        Returns cursor rectangle.
        Parameters:
        dataPosition - data position
        codeOffset - code offset
        section - section
        Returns:
        cursor rectangle or empty rectangle
      • updateRectToCursorPosition

        protected void updateRectToCursorPosition​(java.awt.Rectangle rect,
                                                  long dataPosition,
                                                  int codeOffset,
                                                  org.exbin.bined.CodeAreaSection section)
      • updateScrollBars

        public void updateScrollBars()
        Specified by:
        updateScrollBars in interface org.exbin.bined.swing.CodeAreaPainter
      • scrollPositionModified

        public void scrollPositionModified()
        Specified by:
        scrollPositionModified in interface org.exbin.bined.swing.CodeAreaPainter
      • scrollPositionChanged

        public void scrollPositionChanged()
        Specified by:
        scrollPositionChanged in interface org.exbin.bined.swing.CodeAreaPainter
      • getCharactersPerRow

        protected int getCharactersPerRow()
      • getBytesPerRow

        public int getBytesPerRow()
      • getRowHeight

        public int getRowHeight()