Class WrappedSyntaxView.WrappedLine

java.lang.Object
javax.swing.text.View
org.fife.ui.rsyntaxtextarea.WrappedSyntaxView.WrappedLine
All Implemented Interfaces:
SwingConstants
Enclosing class:
WrappedSyntaxView

class WrappedSyntaxView.WrappedLine extends View
Simple view of a line that wraps if it doesn't fit within the horizontal space allocated. This class tries to be lightweight by carrying little state of its own and sharing the state of the outer class with its siblings.
  • Field Details

    • nlines

      private int nlines
    • widthChangePending

      private boolean widthChangePending
  • Constructor Details

    • WrappedLine

      WrappedLine(Element elem)
  • Method Details

    • calculateLineCount

      final int calculateLineCount()
      Calculate the number of lines that will be rendered by logical line when it is wrapped.
    • getPreferredSpan

      public float getPreferredSpan(int axis)
      Determines the preferred span for this view along an axis.
      Specified by:
      getPreferredSpan in class View
      Parameters:
      axis - may be either X_AXIS or Y_AXIS
      Returns:
      the span the view would like to be rendered into. Typically the view is told to render into the span that is returned, although there is no guarantee. The parent may choose to resize or break the view.
      See Also:
    • paint

      public void paint(Graphics g, Shape a)
      Renders using the given rendering surface and area on that surface. The view may need to do layout and create child views to enable itself to render into the given allocation.
      Specified by:
      paint in class View
      Parameters:
      g - the rendering surface to use
      a - the allocated region to render into
      See Also:
    • modelToView

      public Shape modelToView(int pos, Shape a, Position.Bias b) throws BadLocationException
      Provides a mapping from the document model coordinate space to the coordinate space of the view mapped to it.
      Specified by:
      modelToView in class View
      Parameters:
      pos - the position to convert
      a - the allocated region to render into
      Returns:
      the bounding box of the given position is returned
      Throws:
      BadLocationException - if the given position does not represent a valid location in the associated document.
    • viewToModel

      public int viewToModel(float fx, float fy, Shape a, Position.Bias[] bias)
      Provides a mapping from the view coordinate space to the logical coordinate space of the model.
      Specified by:
      viewToModel in class View
      Parameters:
      fx - the X coordinate
      fy - the Y coordinate
      a - the allocated region to render into
      Returns:
      the location within the model that best represents the given point in the view
      See Also:
    • handleDocumentEvent

      private void handleDocumentEvent(DocumentEvent e, Shape a, ViewFactory f)
    • insertUpdate

      public void insertUpdate(DocumentEvent e, Shape a, ViewFactory f)
      Overrides:
      insertUpdate in class View
    • removeUpdate

      public void removeUpdate(DocumentEvent e, Shape a, ViewFactory f)
      Overrides:
      removeUpdate in class View