WrappedPlainView (Java SE 15 & JDK 15) (original) (raw)

All Implemented Interfaces:

[SwingConstants](../SwingConstants.html "interface in javax.swing"), [TabExpander](TabExpander.html "interface in javax.swing.text")


public class WrappedPlainView extends BoxView implements TabExpander

View of plain text (text with only one font and color) that does line-wrapping. This view expects that its associated element has child elements that represent the lines it should be wrapping. It is implemented as a vertical box that contains logical line views. The logical line views are nested classes that render the logical line as multiple physical line if the logical line is too wide to fit within the allocation. The line views draw upon the outer class for its state to reduce their memory requirements.

The line views do all of their rendering through thedrawLine method which in turn does all of its rendering through the drawSelectedText and drawUnselectedText methods. This enables subclasses to easily specialize the rendering without concern for the layout aspects.

See Also:

View

Fields declared in interface javax.swing.SwingConstants

[BOTTOM](../SwingConstants.html#BOTTOM), [CENTER](../SwingConstants.html#CENTER), [EAST](../SwingConstants.html#EAST), [HORIZONTAL](../SwingConstants.html#HORIZONTAL), [LEADING](../SwingConstants.html#LEADING), [LEFT](../SwingConstants.html#LEFT), [NEXT](../SwingConstants.html#NEXT), [NORTH](../SwingConstants.html#NORTH), [NORTH_EAST](../SwingConstants.html#NORTH%5FEAST), [NORTH_WEST](../SwingConstants.html#NORTH%5FWEST), [PREVIOUS](../SwingConstants.html#PREVIOUS), [RIGHT](../SwingConstants.html#RIGHT), [SOUTH](../SwingConstants.html#SOUTH), [SOUTH_EAST](../SwingConstants.html#SOUTH%5FEAST), [SOUTH_WEST](../SwingConstants.html#SOUTH%5FWEST), [TOP](../SwingConstants.html#TOP), [TRAILING](../SwingConstants.html#TRAILING), [VERTICAL](../SwingConstants.html#VERTICAL), [WEST](../SwingConstants.html#WEST)

Constructors

Constructor Description
WrappedPlainView​(Element elem) Creates a new WrappedPlainView.
WrappedPlainView​(Element elem, boolean wordWrap) Creates a new WrappedPlainView.
Modifier and Type Method Description
protected int calculateBreakPosition​(int p0, int p1) This is called by the nested wrapped line views to determine the break location.
void changedUpdate​(DocumentEvent e,Shape a,ViewFactory f) Gives notification from the document that attributes were changed in a location that this view is responsible for.
protected void drawLine​(int p0, int p1,Graphics2D g, float x, float y) Renders a line of text, suppressing whitespace at the end and expanding any tabs.
protected void drawLine​(int p0, int p1,Graphics g, int x, int y) Deprecated.
protected float drawSelectedText​(Graphics2D g, float x, float y, int p0, int p1) Renders the given range in the model as selected text.
protected int drawSelectedText​(Graphics g, int x, int y, int p0, int p1) Deprecated.
protected float drawUnselectedText​(Graphics2D g, float x, float y, int p0, int p1) Renders the given range in the model as normal unselected text.
protected int drawUnselectedText​(Graphics g, int x, int y, int p0, int p1) Deprecated.
protected Segment getLineBuffer() Gives access to a buffer that can be used to fetch text from the associated document.
float getMaximumSpan​(int axis) Determines the maximum span for this view along an axis.
float getMinimumSpan​(int axis) Determines the minimum span for this view along an axis.
float getPreferredSpan​(int axis) Determines the preferred span for this view along an axis.
protected int getTabSize() Returns the tab size set for the document, defaulting to 8.
void insertUpdate​(DocumentEvent e,Shape a,ViewFactory f) Gives notification that something was inserted into the document in a location that this view is responsible for.
protected void loadChildren​(ViewFactory f) Loads all of the children to initialize the view.
float nextTabStop​(float x, int tabOffset) Returns the next tab stop position after a given reference position.
void paint​(Graphics g,Shape a) Renders using the given rendering surface and area on that surface.
void removeUpdate​(DocumentEvent e,Shape a,ViewFactory f) Gives notification that something was removed from the document in a location that this view is responsible for.
void setSize​(float width, float height) Sets the size of the view.

Methods declared in class javax.swing.text.BoxView

[baselineLayout](BoxView.html#baselineLayout%28int,int,int%5B%5D,int%5B%5D%29), [baselineRequirements](BoxView.html#baselineRequirements%28int,javax.swing.SizeRequirements%29), [calculateMajorAxisRequirements](BoxView.html#calculateMajorAxisRequirements%28int,javax.swing.SizeRequirements%29), [calculateMinorAxisRequirements](BoxView.html#calculateMinorAxisRequirements%28int,javax.swing.SizeRequirements%29), [childAllocation](BoxView.html#childAllocation%28int,java.awt.Rectangle%29), [flipEastAndWestAtEnds](BoxView.html#flipEastAndWestAtEnds%28int,javax.swing.text.Position.Bias%29), [forwardUpdate](BoxView.html#forwardUpdate%28javax.swing.event.DocumentEvent.ElementChange,javax.swing.event.DocumentEvent,java.awt.Shape,javax.swing.text.ViewFactory%29), [getAlignment](BoxView.html#getAlignment%28int%29), [getAxis](BoxView.html#getAxis%28%29), [getChildAllocation](BoxView.html#getChildAllocation%28int,java.awt.Shape%29), [getHeight](BoxView.html#getHeight%28%29), [getOffset](BoxView.html#getOffset%28int,int%29), [getResizeWeight](BoxView.html#getResizeWeight%28int%29), [getSpan](BoxView.html#getSpan%28int,int%29), [getViewAtPoint](BoxView.html#getViewAtPoint%28int,int,java.awt.Rectangle%29), [getWidth](BoxView.html#getWidth%28%29), [isAfter](BoxView.html#isAfter%28int,int,java.awt.Rectangle%29), [isAllocationValid](BoxView.html#isAllocationValid%28%29), [isBefore](BoxView.html#isBefore%28int,int,java.awt.Rectangle%29), [isLayoutValid](BoxView.html#isLayoutValid%28int%29), [layout](BoxView.html#layout%28int,int%29), [layoutChanged](BoxView.html#layoutChanged%28int%29), [layoutMajorAxis](BoxView.html#layoutMajorAxis%28int,int,int%5B%5D,int%5B%5D%29), [layoutMinorAxis](BoxView.html#layoutMinorAxis%28int,int,int%5B%5D,int%5B%5D%29), [modelToView](BoxView.html#modelToView%28int,java.awt.Shape,javax.swing.text.Position.Bias%29), [paintChild](BoxView.html#paintChild%28java.awt.Graphics,java.awt.Rectangle,int%29), [preferenceChanged](BoxView.html#preferenceChanged%28javax.swing.text.View,boolean,boolean%29), [replace](BoxView.html#replace%28int,int,javax.swing.text.View%5B%5D%29), [setAxis](BoxView.html#setAxis%28int%29), [viewToModel](BoxView.html#viewToModel%28float,float,java.awt.Shape,javax.swing.text.Position.Bias%5B%5D%29)

Methods declared in class javax.swing.text.CompositeView

[getBottomInset](CompositeView.html#getBottomInset%28%29), [getInsideAllocation](CompositeView.html#getInsideAllocation%28java.awt.Shape%29), [getLeftInset](CompositeView.html#getLeftInset%28%29), [getNextEastWestVisualPositionFrom](CompositeView.html#getNextEastWestVisualPositionFrom%28int,javax.swing.text.Position.Bias,java.awt.Shape,int,javax.swing.text.Position.Bias%5B%5D%29), [getNextNorthSouthVisualPositionFrom](CompositeView.html#getNextNorthSouthVisualPositionFrom%28int,javax.swing.text.Position.Bias,java.awt.Shape,int,javax.swing.text.Position.Bias%5B%5D%29), [getNextVisualPositionFrom](CompositeView.html#getNextVisualPositionFrom%28int,javax.swing.text.Position.Bias,java.awt.Shape,int,javax.swing.text.Position.Bias%5B%5D%29), [getRightInset](CompositeView.html#getRightInset%28%29), [getTopInset](CompositeView.html#getTopInset%28%29), [getView](CompositeView.html#getView%28int%29), [getViewAtPosition](CompositeView.html#getViewAtPosition%28int,java.awt.Rectangle%29), [getViewCount](CompositeView.html#getViewCount%28%29), [getViewIndex](CompositeView.html#getViewIndex%28int,javax.swing.text.Position.Bias%29), [getViewIndexAtPosition](CompositeView.html#getViewIndexAtPosition%28int%29), [modelToView](CompositeView.html#modelToView%28int,javax.swing.text.Position.Bias,int,javax.swing.text.Position.Bias,java.awt.Shape%29), [setInsets](CompositeView.html#setInsets%28short,short,short,short%29), [setParagraphInsets](CompositeView.html#setParagraphInsets%28javax.swing.text.AttributeSet%29), [setParent](CompositeView.html#setParent%28javax.swing.text.View%29)

Methods declared in class javax.swing.text.View

[append](View.html#append%28javax.swing.text.View%29), [breakView](View.html#breakView%28int,int,float,float%29), [createFragment](View.html#createFragment%28int,int%29), [forwardUpdateToView](View.html#forwardUpdateToView%28javax.swing.text.View,javax.swing.event.DocumentEvent,java.awt.Shape,javax.swing.text.ViewFactory%29), [getAttributes](View.html#getAttributes%28%29), [getBreakWeight](View.html#getBreakWeight%28int,float,float%29), [getContainer](View.html#getContainer%28%29), [getDocument](View.html#getDocument%28%29), [getElement](View.html#getElement%28%29), [getEndOffset](View.html#getEndOffset%28%29), [getGraphics](View.html#getGraphics%28%29), [getParent](View.html#getParent%28%29), [getStartOffset](View.html#getStartOffset%28%29), [getToolTipText](View.html#getToolTipText%28float,float,java.awt.Shape%29), [getViewFactory](View.html#getViewFactory%28%29), [getViewIndex](View.html#getViewIndex%28float,float,java.awt.Shape%29), [insert](View.html#insert%28int,javax.swing.text.View%29), [isVisible](View.html#isVisible%28%29), [modelToView](View.html#modelToView%28int,java.awt.Shape%29), [remove](View.html#remove%28int%29), [removeAll](View.html#removeAll%28%29), [updateChildren](View.html#updateChildren%28javax.swing.event.DocumentEvent.ElementChange,javax.swing.event.DocumentEvent,javax.swing.text.ViewFactory%29), [updateLayout](View.html#updateLayout%28javax.swing.event.DocumentEvent.ElementChange,javax.swing.event.DocumentEvent,java.awt.Shape%29), [viewToModel](View.html#viewToModel%28float,float,java.awt.Shape%29)

Methods declared in class java.lang.Object

[clone](../../../../java.base/java/lang/Object.html#clone%28%29), [equals](../../../../java.base/java/lang/Object.html#equals%28java.lang.Object%29), [finalize](../../../../java.base/java/lang/Object.html#finalize%28%29), [getClass](../../../../java.base/java/lang/Object.html#getClass%28%29), [hashCode](../../../../java.base/java/lang/Object.html#hashCode%28%29), [notify](../../../../java.base/java/lang/Object.html#notify%28%29), [notifyAll](../../../../java.base/java/lang/Object.html#notifyAll%28%29), [toString](../../../../java.base/java/lang/Object.html#toString%28%29), [wait](../../../../java.base/java/lang/Object.html#wait%28%29), [wait](../../../../java.base/java/lang/Object.html#wait%28long%29), [wait](../../../../java.base/java/lang/Object.html#wait%28long,int%29)