Package org.fife.ui.rsyntaxtextarea
Class WrappedSyntaxView.WrappedLine
java.lang.Object
javax.swing.text.View
org.fife.ui.rsyntaxtextarea.WrappedSyntaxView.WrappedLine
- All Implemented Interfaces:
SwingConstants
- Enclosing class:
WrappedSyntaxView
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 Summary
FieldsFields inherited from class javax.swing.text.View
BadBreakWeight, ExcellentBreakWeight, ForcedBreakWeight, GoodBreakWeight, X_AXIS, Y_AXIS
Fields inherited from interface javax.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) final int
Calculate the number of lines that will be rendered by logical line when it is wrapped.float
getPreferredSpan
(int axis) Determines the preferred span for this view along an axis.private void
handleDocumentEvent
(DocumentEvent e, Shape a, ViewFactory f) void
insertUpdate
(DocumentEvent e, Shape a, ViewFactory f) modelToView
(int pos, Shape a, Position.Bias b) Provides a mapping from the document model coordinate space to the coordinate space of the view mapped to it.void
Renders using the given rendering surface and area on that surface.void
removeUpdate
(DocumentEvent e, Shape a, ViewFactory f) 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.Methods inherited from class javax.swing.text.View
append, breakView, changedUpdate, createFragment, forwardUpdate, forwardUpdateToView, getAlignment, getAttributes, getBreakWeight, getChildAllocation, getContainer, getDocument, getElement, getEndOffset, getGraphics, getMaximumSpan, getMinimumSpan, getNextVisualPositionFrom, getParent, getResizeWeight, getStartOffset, getToolTipText, getView, getViewCount, getViewFactory, getViewIndex, getViewIndex, insert, isVisible, modelToView, modelToView, preferenceChanged, remove, removeAll, replace, setParent, setSize, updateChildren, updateLayout, viewToModel
-
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 classView
- 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
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. -
modelToView
Provides a mapping from the document model coordinate space to the coordinate space of the view mapped to it.- Specified by:
modelToView
in classView
- Parameters:
pos
- the position to converta
- 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
Provides a mapping from the view coordinate space to the logical coordinate space of the model.- Specified by:
viewToModel
in classView
- Parameters:
fx
- the X coordinatefy
- the Y coordinatea
- the allocated region to render into- Returns:
- the location within the model that best represents the given point in the view
- See Also:
-
handleDocumentEvent
-
insertUpdate
- Overrides:
insertUpdate
in classView
-
removeUpdate
- Overrides:
removeUpdate
in classView
-