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.
- Version:
- 0.2
-
Field Summary
FieldsFields inherited from class View
BadBreakWeight, ExcellentBreakWeight, ForcedBreakWeight, GoodBreakWeight, X_AXIS, Y_AXISFields inherited from interface 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 intCalculate the number of lines that will be rendered by logical line when it is wrapped.floatgetPreferredSpan(int axis) Determines the preferred span for this view along an axis.private voidhandleDocumentEvent(DocumentEvent e, Shape a, ViewFactory f) voidinsertUpdate(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.voidRenders using the given rendering surface and area on that surface.voidremoveUpdate(DocumentEvent e, Shape a, ViewFactory f) intviewToModel(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 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:
getPreferredSpanin 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:
modelToViewin 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:
viewToModelin 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:
insertUpdatein classView
-
removeUpdate
- Overrides:
removeUpdatein classView
-