javax.swing.text
Class WrappedPlainView

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by javax.swing.text.View sample code for javax.swing.text.View definition code for javax.swing.text.View 
      extended by javax.swing.text.CompositeView sample code for javax.swing.text.CompositeView definition code for javax.swing.text.CompositeView 
          extended by javax.swing.text.BoxView sample code for javax.swing.text.BoxView definition code for javax.swing.text.BoxView 
              extended by javax.swing.text.WrappedPlainView
All Implemented Interfaces:
SwingConstants sample code for javax.swing.SwingConstants definition code for javax.swing.SwingConstants , TabExpander sample code for javax.swing.text.TabExpander definition code for javax.swing.text.TabExpander

public class WrappedPlainView
extends BoxView sample code for javax.swing.text.BoxView definition code for javax.swing.text.BoxView
implements TabExpander sample code for javax.swing.text.TabExpander definition code for javax.swing.text.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 the drawLine 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 sample code for javax.swing.text.View definition code for javax.swing.text.View

Field Summary
 
Fields inherited from class javax.swing.text.View sample code for javax.swing.text.View definition code for javax.swing.text.View
BadBreakWeight sample code for javax.swing.text.View.BadBreakWeight definition code for javax.swing.text.View.BadBreakWeight , ExcellentBreakWeight sample code for javax.swing.text.View.ExcellentBreakWeight definition code for javax.swing.text.View.ExcellentBreakWeight , ForcedBreakWeight sample code for javax.swing.text.View.ForcedBreakWeight definition code for javax.swing.text.View.ForcedBreakWeight , GoodBreakWeight sample code for javax.swing.text.View.GoodBreakWeight definition code for javax.swing.text.View.GoodBreakWeight , X_AXIS sample code for javax.swing.text.View.X_AXIS definition code for javax.swing.text.View.X_AXIS , Y_AXIS sample code for javax.swing.text.View.Y_AXIS definition code for javax.swing.text.View.Y_AXIS
 
Fields inherited from interface javax.swing.SwingConstants sample code for javax.swing.SwingConstants definition code for javax.swing.SwingConstants
BOTTOM sample code for javax.swing.SwingConstants.BOTTOM definition code for javax.swing.SwingConstants.BOTTOM , CENTER sample code for javax.swing.SwingConstants.CENTER definition code for javax.swing.SwingConstants.CENTER , EAST sample code for javax.swing.SwingConstants.EAST definition code for javax.swing.SwingConstants.EAST , HORIZONTAL sample code for javax.swing.SwingConstants.HORIZONTAL definition code for javax.swing.SwingConstants.HORIZONTAL , LEADING sample code for javax.swing.SwingConstants.LEADING definition code for javax.swing.SwingConstants.LEADING , LEFT sample code for javax.swing.SwingConstants.LEFT definition code for javax.swing.SwingConstants.LEFT , NEXT sample code for javax.swing.SwingConstants.NEXT definition code for javax.swing.SwingConstants.NEXT , NORTH sample code for javax.swing.SwingConstants.NORTH definition code for javax.swing.SwingConstants.NORTH , NORTH_EAST sample code for javax.swing.SwingConstants.NORTH_EAST definition code for javax.swing.SwingConstants.NORTH_EAST , NORTH_WEST sample code for javax.swing.SwingConstants.NORTH_WEST definition code for javax.swing.SwingConstants.NORTH_WEST , PREVIOUS sample code for javax.swing.SwingConstants.PREVIOUS definition code for javax.swing.SwingConstants.PREVIOUS , RIGHT sample code for javax.swing.SwingConstants.RIGHT definition code for javax.swing.SwingConstants.RIGHT , SOUTH sample code for javax.swing.SwingConstants.SOUTH definition code for javax.swing.SwingConstants.SOUTH , SOUTH_EAST sample code for javax.swing.SwingConstants.SOUTH_EAST definition code for javax.swing.SwingConstants.SOUTH_EAST , SOUTH_WEST sample code for javax.swing.SwingConstants.SOUTH_WEST definition code for javax.swing.SwingConstants.SOUTH_WEST , TOP sample code for javax.swing.SwingConstants.TOP definition code for javax.swing.SwingConstants.TOP , TRAILING sample code for javax.swing.SwingConstants.TRAILING definition code for javax.swing.SwingConstants.TRAILING , VERTICAL sample code for javax.swing.SwingConstants.VERTICAL definition code for javax.swing.SwingConstants.VERTICAL , WEST sample code for javax.swing.SwingConstants.WEST definition code for javax.swing.SwingConstants.WEST
 
Constructor Summary
WrappedPlainView sample code for javax.swing.text.WrappedPlainView.WrappedPlainView(javax.swing.text.Element) definition code for javax.swing.text.WrappedPlainView.WrappedPlainView(javax.swing.text.Element) (Element sample code for javax.swing.text.Element definition code for javax.swing.text.Element  elem)
          Creates a new WrappedPlainView.
WrappedPlainView sample code for javax.swing.text.WrappedPlainView.WrappedPlainView(javax.swing.text.Element, boolean) definition code for javax.swing.text.WrappedPlainView.WrappedPlainView(javax.swing.text.Element, boolean) (Element sample code for javax.swing.text.Element definition code for javax.swing.text.Element  elem, boolean wordWrap)
          Creates a new WrappedPlainView.
 
Method Summary
protected  int calculateBreakPosition sample code for javax.swing.text.WrappedPlainView.calculateBreakPosition(int, int) definition code for javax.swing.text.WrappedPlainView.calculateBreakPosition(int, int) (int p0, int p1)
          This is called by the nested wrapped line views to determine the break location.
 void changedUpdate sample code for javax.swing.text.WrappedPlainView.changedUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory) definition code for javax.swing.text.WrappedPlainView.changedUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory) (DocumentEvent sample code for javax.swing.event.DocumentEvent definition code for javax.swing.event.DocumentEvent  e, Shape sample code for java.awt.Shape definition code for java.awt.Shape  a, ViewFactory sample code for javax.swing.text.ViewFactory definition code for javax.swing.text.ViewFactory  f)
          Gives notification from the document that attributes were changed in a location that this view is responsible for.
protected  void drawLine sample code for javax.swing.text.WrappedPlainView.drawLine(int, int, java.awt.Graphics, int, int) definition code for javax.swing.text.WrappedPlainView.drawLine(int, int, java.awt.Graphics, int, int) (int p0, int p1, Graphics sample code for java.awt.Graphics definition code for java.awt.Graphics  g, int x, int y)
          Renders a line of text, suppressing whitespace at the end and expanding any tabs.
protected  int drawSelectedText sample code for javax.swing.text.WrappedPlainView.drawSelectedText(java.awt.Graphics, int, int, int, int) definition code for javax.swing.text.WrappedPlainView.drawSelectedText(java.awt.Graphics, int, int, int, int) (Graphics sample code for java.awt.Graphics definition code for java.awt.Graphics  g, int x, int y, int p0, int p1)
          Renders the given range in the model as selected text.
protected  int drawUnselectedText sample code for javax.swing.text.WrappedPlainView.drawUnselectedText(java.awt.Graphics, int, int, int, int) definition code for javax.swing.text.WrappedPlainView.drawUnselectedText(java.awt.Graphics, int, int, int, int) (Graphics sample code for java.awt.Graphics definition code for java.awt.Graphics  g, int x, int y, int p0, int p1)
          Renders the given range in the model as normal unselected text.
protected  Segment sample code for javax.swing.text.Segment definition code for javax.swing.text.Segment getLineBuffer sample code for javax.swing.text.WrappedPlainView.getLineBuffer() definition code for javax.swing.text.WrappedPlainView.getLineBuffer() ()
          Gives access to a buffer that can be used to fetch text from the associated document.
 float getMaximumSpan sample code for javax.swing.text.WrappedPlainView.getMaximumSpan(int) definition code for javax.swing.text.WrappedPlainView.getMaximumSpan(int) (int axis)
          Determines the maximum span for this view along an axis.
 float getMinimumSpan sample code for javax.swing.text.WrappedPlainView.getMinimumSpan(int) definition code for javax.swing.text.WrappedPlainView.getMinimumSpan(int) (int axis)
          Determines the minimum span for this view along an axis.
 float getPreferredSpan sample code for javax.swing.text.WrappedPlainView.getPreferredSpan(int) definition code for javax.swing.text.WrappedPlainView.getPreferredSpan(int) (int axis)
          Determines the preferred span for this view along an axis.
protected  int getTabSize sample code for javax.swing.text.WrappedPlainView.getTabSize() definition code for javax.swing.text.WrappedPlainView.getTabSize() ()
          Returns the tab size set for the document, defaulting to 8.
 void insertUpdate sample code for javax.swing.text.WrappedPlainView.insertUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory) definition code for javax.swing.text.WrappedPlainView.insertUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory) (DocumentEvent sample code for javax.swing.event.DocumentEvent definition code for javax.swing.event.DocumentEvent  e, Shape sample code for java.awt.Shape definition code for java.awt.Shape  a, ViewFactory sample code for javax.swing.text.ViewFactory definition code for javax.swing.text.ViewFactory  f)
          Gives notification that something was inserted into the document in a location that this view is responsible for.
protected  void loadChildren sample code for javax.swing.text.WrappedPlainView.loadChildren(javax.swing.text.ViewFactory) definition code for javax.swing.text.WrappedPlainView.loadChildren(javax.swing.text.ViewFactory) (ViewFactory sample code for javax.swing.text.ViewFactory definition code for javax.swing.text.ViewFactory  f)
          Loads all of the children to initialize the view.
 float nextTabStop sample code for javax.swing.text.WrappedPlainView.nextTabStop(float, int) definition code for javax.swing.text.WrappedPlainView.nextTabStop(float, int) (float x, int tabOffset)
          Returns the next tab stop position after a given reference position.
 void paint sample code for javax.swing.text.WrappedPlainView.paint(java.awt.Graphics, java.awt.Shape) definition code for javax.swing.text.WrappedPlainView.paint(java.awt.Graphics, java.awt.Shape) (Graphics sample code for java.awt.Graphics definition code for java.awt.Graphics  g, Shape sample code for java.awt.Shape definition code for java.awt.Shape  a)
          Renders using the given rendering surface and area on that surface.
 void removeUpdate sample code for javax.swing.text.WrappedPlainView.removeUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory) definition code for javax.swing.text.WrappedPlainView.removeUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory) (DocumentEvent sample code for javax.swing.event.DocumentEvent definition code for javax.swing.event.DocumentEvent  e, Shape sample code for java.awt.Shape definition code for java.awt.Shape  a, ViewFactory sample code for javax.swing.text.ViewFactory definition code for javax.swing.text.ViewFactory  f)
          Gives notification that something was removed from the document in a location that this view is responsible for.
 void setSize sample code for javax.swing.text.WrappedPlainView.setSize(float, float) definition code for javax.swing.text.WrappedPlainView.setSize(float, float) (float width, float height)
          Sets the size of the view.
 
Methods inherited from class javax.swing.text.BoxView sample code for javax.swing.text.BoxView definition code for javax.swing.text.BoxView
baselineLayout sample code for javax.swing.text.BoxView.baselineLayout(int, int, int[], int[]) definition code for javax.swing.text.BoxView.baselineLayout(int, int, int[], int[]) , baselineRequirements sample code for javax.swing.text.BoxView.baselineRequirements(int, javax.swing.SizeRequirements) definition code for javax.swing.text.BoxView.baselineRequirements(int, javax.swing.SizeRequirements) , calculateMajorAxisRequirements sample code for javax.swing.text.BoxView.calculateMajorAxisRequirements(int, javax.swing.SizeRequirements) definition code for javax.swing.text.BoxView.calculateMajorAxisRequirements(int, javax.swing.SizeRequirements) , calculateMinorAxisRequirements sample code for javax.swing.text.BoxView.calculateMinorAxisRequirements(int, javax.swing.SizeRequirements) definition code for javax.swing.text.BoxView.calculateMinorAxisRequirements(int, javax.swing.SizeRequirements) , childAllocation sample code for javax.swing.text.BoxView.childAllocation(int, java.awt.Rectangle) definition code for javax.swing.text.BoxView.childAllocation(int, java.awt.Rectangle) , flipEastAndWestAtEnds sample code for javax.swing.text.BoxView.flipEastAndWestAtEnds(int, javax.swing.text.Position.Bias) definition code for javax.swing.text.BoxView.flipEastAndWestAtEnds(int, javax.swing.text.Position.Bias) , forwardUpdate sample code for javax.swing.text.BoxView.forwardUpdate(javax.swing.event.DocumentEvent.ElementChange, javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory) definition code for javax.swing.text.BoxView.forwardUpdate(javax.swing.event.DocumentEvent.ElementChange, javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory) , getAlignment sample code for javax.swing.text.BoxView.getAlignment(int) definition code for javax.swing.text.BoxView.getAlignment(int) , getAxis sample code for javax.swing.text.BoxView.getAxis() definition code for javax.swing.text.BoxView.getAxis() , getChildAllocation sample code for javax.swing.text.BoxView.getChildAllocation(int, java.awt.Shape) definition code for javax.swing.text.BoxView.getChildAllocation(int, java.awt.Shape) , getHeight sample code for javax.swing.text.BoxView.getHeight() definition code for javax.swing.text.BoxView.getHeight() , getOffset sample code for javax.swing.text.BoxView.getOffset(int, int) definition code for javax.swing.text.BoxView.getOffset(int, int) , getResizeWeight sample code for javax.swing.text.BoxView.getResizeWeight(int) definition code for javax.swing.text.BoxView.getResizeWeight(int) , getSpan sample code for javax.swing.text.BoxView.getSpan(int, int) definition code for javax.swing.text.BoxView.getSpan(int, int) , getViewAtPoint sample code for javax.swing.text.BoxView.getViewAtPoint(int, int, java.awt.Rectangle) definition code for javax.swing.text.BoxView.getViewAtPoint(int, int, java.awt.Rectangle) , getWidth sample code for javax.swing.text.BoxView.getWidth() definition code for javax.swing.text.BoxView.getWidth() , isAfter sample code for javax.swing.text.BoxView.isAfter(int, int, java.awt.Rectangle) definition code for javax.swing.text.BoxView.isAfter(int, int, java.awt.Rectangle) , isAllocationValid sample code for javax.swing.text.BoxView.isAllocationValid() definition code for javax.swing.text.BoxView.isAllocationValid() , isBefore sample code for javax.swing.text.BoxView.isBefore(int, int, java.awt.Rectangle) definition code for javax.swing.text.BoxView.isBefore(int, int, java.awt.Rectangle) , isLayoutValid sample code for javax.swing.text.BoxView.isLayoutValid(int) definition code for javax.swing.text.BoxView.isLayoutValid(int) , layout sample code for javax.swing.text.BoxView.layout(int, int) definition code for javax.swing.text.BoxView.layout(int, int) , layoutChanged sample code for javax.swing.text.BoxView.layoutChanged(int) definition code for javax.swing.text.BoxView.layoutChanged(int) , layoutMajorAxis sample code for javax.swing.text.BoxView.layoutMajorAxis(int, int, int[], int[]) definition code for javax.swing.text.BoxView.layoutMajorAxis(int, int, int[], int[]) , layoutMinorAxis sample code for javax.swing.text.BoxView.layoutMinorAxis(int, int, int[], int[]) definition code for javax.swing.text.BoxView.layoutMinorAxis(int, int, int[], int[]) , modelToView sample code for javax.swing.text.BoxView.modelToView(int, java.awt.Shape, javax.swing.text.Position.Bias) definition code for javax.swing.text.BoxView.modelToView(int, java.awt.Shape, javax.swing.text.Position.Bias) , paintChild sample code for javax.swing.text.BoxView.paintChild(java.awt.Graphics, java.awt.Rectangle, int) definition code for javax.swing.text.BoxView.paintChild(java.awt.Graphics, java.awt.Rectangle, int) , preferenceChanged sample code for javax.swing.text.BoxView.preferenceChanged(javax.swing.text.View, boolean, boolean) definition code for javax.swing.text.BoxView.preferenceChanged(javax.swing.text.View, boolean, boolean) , replace sample code for javax.swing.text.BoxView.replace(int, int, javax.swing.text.View[]) definition code for javax.swing.text.BoxView.replace(int, int, javax.swing.text.View[]) , setAxis sample code for javax.swing.text.BoxView.setAxis(int) definition code for javax.swing.text.BoxView.setAxis(int) , viewToModel sample code for javax.swing.text.BoxView.viewToModel(float, float, java.awt.Shape, javax.swing.text.Position.Bias[]) definition code for javax.swing.text.BoxView.viewToModel(float, float, java.awt.Shape, javax.swing.text.Position.Bias[])
 
Methods inherited from class javax.swing.text.CompositeView sample code for javax.swing.text.CompositeView definition code for javax.swing.text.CompositeView
getBottomInset sample code for javax.swing.text.CompositeView.getBottomInset() definition code for javax.swing.text.CompositeView.getBottomInset() , getInsideAllocation sample code for javax.swing.text.CompositeView.getInsideAllocation(java.awt.Shape) definition code for javax.swing.text.CompositeView.getInsideAllocation(java.awt.Shape) , getLeftInset sample code for javax.swing.text.CompositeView.getLeftInset() definition code for javax.swing.text.CompositeView.getLeftInset() , getNextEastWestVisualPositionFrom sample code for javax.swing.text.CompositeView.getNextEastWestVisualPositionFrom(int, javax.swing.text.Position.Bias, java.awt.Shape, int, javax.swing.text.Position.Bias[]) definition code for javax.swing.text.CompositeView.getNextEastWestVisualPositionFrom(int, javax.swing.text.Position.Bias, java.awt.Shape, int, javax.swing.text.Position.Bias[]) , getNextNorthSouthVisualPositionFrom sample code for javax.swing.text.CompositeView.getNextNorthSouthVisualPositionFrom(int, javax.swing.text.Position.Bias, java.awt.Shape, int, javax.swing.text.Position.Bias[]) definition code for javax.swing.text.CompositeView.getNextNorthSouthVisualPositionFrom(int, javax.swing.text.Position.Bias, java.awt.Shape, int, javax.swing.text.Position.Bias[]) , getNextVisualPositionFrom sample code for javax.swing.text.CompositeView.getNextVisualPositionFrom(int, javax.swing.text.Position.Bias, java.awt.Shape, int, javax.swing.text.Position.Bias[]) definition code for javax.swing.text.CompositeView.getNextVisualPositionFrom(int, javax.swing.text.Position.Bias, java.awt.Shape, int, javax.swing.text.Position.Bias[]) , getRightInset sample code for javax.swing.text.CompositeView.getRightInset() definition code for javax.swing.text.CompositeView.getRightInset() , getTopInset sample code for javax.swing.text.CompositeView.getTopInset() definition code for javax.swing.text.CompositeView.getTopInset() , getView sample code for javax.swing.text.CompositeView.getView(int) definition code for javax.swing.text.CompositeView.getView(int) , getViewAtPosition sample code for javax.swing.text.CompositeView.getViewAtPosition(int, java.awt.Rectangle) definition code for javax.swing.text.CompositeView.getViewAtPosition(int, java.awt.Rectangle) , getViewCount sample code for javax.swing.text.CompositeView.getViewCount() definition code for javax.swing.text.CompositeView.getViewCount() , getViewIndex sample code for javax.swing.text.CompositeView.getViewIndex(int, javax.swing.text.Position.Bias) definition code for javax.swing.text.CompositeView.getViewIndex(int, javax.swing.text.Position.Bias) , getViewIndexAtPosition sample code for javax.swing.text.CompositeView.getViewIndexAtPosition(int) definition code for javax.swing.text.CompositeView.getViewIndexAtPosition(int) , modelToView sample code for javax.swing.text.CompositeView.modelToView(int, javax.swing.text.Position.Bias, int, javax.swing.text.Position.Bias, java.awt.Shape) definition code for javax.swing.text.CompositeView.modelToView(int, javax.swing.text.Position.Bias, int, javax.swing.text.Position.Bias, java.awt.Shape) , setInsets sample code for javax.swing.text.CompositeView.setInsets(short, short, short, short) definition code for javax.swing.text.CompositeView.setInsets(short, short, short, short) , setParagraphInsets sample code for javax.swing.text.CompositeView.setParagraphInsets(javax.swing.text.AttributeSet) definition code for javax.swing.text.CompositeView.setParagraphInsets(javax.swing.text.AttributeSet) , setParent sample code for javax.swing.text.CompositeView.setParent(javax.swing.text.View) definition code for javax.swing.text.CompositeView.setParent(javax.swing.text.View)
 
Methods inherited from class javax.swing.text.View sample code for javax.swing.text.View definition code for javax.swing.text.View
append sample code for javax.swing.text.View.append(javax.swing.text.View) definition code for javax.swing.text.View.append(javax.swing.text.View) , breakView sample code for javax.swing.text.View.breakView(int, int, float, float) definition code for javax.swing.text.View.breakView(int, int, float, float) , createFragment sample code for javax.swing.text.View.createFragment(int, int) definition code for javax.swing.text.View.createFragment(int, int) , forwardUpdateToView sample code for javax.swing.text.View.forwardUpdateToView(javax.swing.text.View, javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory) definition code for javax.swing.text.View.forwardUpdateToView(javax.swing.text.View, javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory) , getAttributes sample code for javax.swing.text.View.getAttributes() definition code for javax.swing.text.View.getAttributes() , getBreakWeight sample code for javax.swing.text.View.getBreakWeight(int, float, float) definition code for javax.swing.text.View.getBreakWeight(int, float, float) , getContainer sample code for javax.swing.text.View.getContainer() definition code for javax.swing.text.View.getContainer() , getDocument sample code for javax.swing.text.View.getDocument() definition code for javax.swing.text.View.getDocument() , getElement sample code for javax.swing.text.View.getElement() definition code for javax.swing.text.View.getElement() , getEndOffset sample code for javax.swing.text.View.getEndOffset() definition code for javax.swing.text.View.getEndOffset() , getGraphics sample code for javax.swing.text.View.getGraphics() definition code for javax.swing.text.View.getGraphics() , getParent sample code for javax.swing.text.View.getParent() definition code for javax.swing.text.View.getParent() , getStartOffset sample code for javax.swing.text.View.getStartOffset() definition code for javax.swing.text.View.getStartOffset() , getToolTipText sample code for javax.swing.text.View.getToolTipText(float, float, java.awt.Shape) definition code for javax.swing.text.View.getToolTipText(float, float, java.awt.Shape) , getViewFactory sample code for javax.swing.text.View.getViewFactory() definition code for javax.swing.text.View.getViewFactory() , getViewIndex sample code for javax.swing.text.View.getViewIndex(float, float, java.awt.Shape) definition code for javax.swing.text.View.getViewIndex(float, float, java.awt.Shape) , insert sample code for javax.swing.text.View.insert(int, javax.swing.text.View) definition code for javax.swing.text.View.insert(int, javax.swing.text.View) , isVisible sample code for javax.swing.text.View.isVisible() definition code for javax.swing.text.View.isVisible() , modelToView sample code for javax.swing.text.View.modelToView(int, java.awt.Shape) definition code for javax.swing.text.View.modelToView(int, java.awt.Shape) , remove sample code for javax.swing.text.View.remove(int) definition code for javax.swing.text.View.remove(int) , removeAll sample code for javax.swing.text.View.removeAll() definition code for javax.swing.text.View.removeAll() , updateChildren sample code for javax.swing.text.View.updateChildren(javax.swing.event.DocumentEvent.ElementChange, javax.swing.event.DocumentEvent, javax.swing.text.ViewFactory) definition code for javax.swing.text.View.updateChildren(javax.swing.event.DocumentEvent.ElementChange, javax.swing.event.DocumentEvent, javax.swing.text.ViewFactory) , updateLayout sample code for javax.swing.text.View.updateLayout(javax.swing.event.DocumentEvent.ElementChange, javax.swing.event.DocumentEvent, java.awt.Shape) definition code for javax.swing.text.View.updateLayout(javax.swing.event.DocumentEvent.ElementChange, javax.swing.event.DocumentEvent, java.awt.Shape) , viewToModel sample code for javax.swing.text.View.viewToModel(float, float, java.awt.Shape) definition code for javax.swing.text.View.viewToModel(float, float, java.awt.Shape)
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , toString sample code for java.lang.Object.toString() definition code for java.lang.Object.toString() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Constructor Detail

WrappedPlainView sample code for javax.swing.text.WrappedPlainView(javax.swing.text.Element) definition code for javax.swing.text.WrappedPlainView(javax.swing.text.Element)

public WrappedPlainView(Element sample code for javax.swing.text.Element definition code for javax.swing.text.Element  elem)
Creates a new WrappedPlainView. Lines will be wrapped on character boundaries.

Parameters:
elem - the element underlying the view

WrappedPlainView sample code for javax.swing.text.WrappedPlainView(javax.swing.text.Element, boolean) definition code for javax.swing.text.WrappedPlainView(javax.swing.text.Element, boolean)

public WrappedPlainView(Element sample code for javax.swing.text.Element definition code for javax.swing.text.Element  elem,
                        boolean wordWrap)
Creates a new WrappedPlainView. Lines can be wrapped on either character or word boundaries depending upon the setting of the wordWrap parameter.

Parameters:
elem - the element underlying the view
wordWrap - should lines be wrapped on word boundaries?
Method Detail

getTabSize sample code for javax.swing.text.WrappedPlainView.getTabSize() definition code for javax.swing.text.WrappedPlainView.getTabSize()

protected int getTabSize()
Returns the tab size set for the document, defaulting to 8.

Returns:
the tab size

drawLine sample code for javax.swing.text.WrappedPlainView.drawLine(int, int, java.awt.Graphics, int, int) definition code for javax.swing.text.WrappedPlainView.drawLine(int, int, java.awt.Graphics, int, int)

protected void drawLine(int p0,
                        int p1,
                        Graphics sample code for java.awt.Graphics definition code for java.awt.Graphics  g,
                        int x,
                        int y)
Renders a line of text, suppressing whitespace at the end and expanding any tabs. This is implemented to make calls to the methods drawUnselectedText and drawSelectedText so that the way selected and unselected text are rendered can be customized.

Parameters:
p0 - the starting document location to use >= 0
p1 - the ending document location to use >= p1
g - the graphics context
x - the starting X position >= 0
y - the starting Y position >= 0
See Also:
drawUnselectedText(java.awt.Graphics, int, int, int, int) sample code for javax.swing.text.WrappedPlainView.drawUnselectedText(java.awt.Graphics, int, int, int, int) definition code for javax.swing.text.WrappedPlainView.drawUnselectedText(java.awt.Graphics, int, int, int, int) , drawSelectedText(java.awt.Graphics, int, int, int, int) sample code for javax.swing.text.WrappedPlainView.drawSelectedText(java.awt.Graphics, int, int, int, int) definition code for javax.swing.text.WrappedPlainView.drawSelectedText(java.awt.Graphics, int, int, int, int)

drawUnselectedText sample code for javax.swing.text.WrappedPlainView.drawUnselectedText(java.awt.Graphics, int, int, int, int) definition code for javax.swing.text.WrappedPlainView.drawUnselectedText(java.awt.Graphics, int, int, int, int)

protected int drawUnselectedText(Graphics sample code for java.awt.Graphics definition code for java.awt.Graphics  g,
                                 int x,
                                 int y,
                                 int p0,
                                 int p1)
                          throws BadLocationException sample code for javax.swing.text.BadLocationException definition code for javax.swing.text.BadLocationException 
Renders the given range in the model as normal unselected text.

Parameters:
g - the graphics context
x - the starting X coordinate >= 0
y - the starting Y coordinate >= 0
p0 - the beginning position in the model >= 0
p1 - the ending position in the model >= p0
Returns:
the X location of the end of the range >= 0
Throws:
BadLocationException sample code for javax.swing.text.BadLocationException definition code for javax.swing.text.BadLocationException - if the range is invalid

drawSelectedText sample code for javax.swing.text.WrappedPlainView.drawSelectedText(java.awt.Graphics, int, int, int, int) definition code for javax.swing.text.WrappedPlainView.drawSelectedText(java.awt.Graphics, int, int, int, int)

protected int drawSelectedText(Graphics sample code for java.awt.Graphics definition code for java.awt.Graphics  g,
                               int x,
                               int y,
                               int p0,
                               int p1)
                        throws BadLocationException sample code for javax.swing.text.BadLocationException definition code for javax.swing.text.BadLocationException 
Renders the given range in the model as selected text. This is implemented to render the text in the color specified in the hosting component. It assumes the highlighter will render the selected background.

Parameters:
g - the graphics context
x - the starting X coordinate >= 0
y - the starting Y coordinate >= 0
p0 - the beginning position in the model >= 0
p1 - the ending position in the model >= p0
Returns:
the location of the end of the range.
Throws:
BadLocationException sample code for javax.swing.text.BadLocationException definition code for javax.swing.text.BadLocationException - if the range is invalid

getLineBuffer sample code for javax.swing.text.WrappedPlainView.getLineBuffer() definition code for javax.swing.text.WrappedPlainView.getLineBuffer()

protected final Segment sample code for javax.swing.text.Segment definition code for javax.swing.text.Segment  getLineBuffer()
Gives access to a buffer that can be used to fetch text from the associated document.

Returns:
the buffer

calculateBreakPosition sample code for javax.swing.text.WrappedPlainView.calculateBreakPosition(int, int) definition code for javax.swing.text.WrappedPlainView.calculateBreakPosition(int, int)

protected int calculateBreakPosition(int p0,
                                     int p1)
This is called by the nested wrapped line views to determine the break location. This can be reimplemented to alter the breaking behavior. It will either break at word or character boundaries depending upon the break argument given at construction.


loadChildren sample code for javax.swing.text.WrappedPlainView.loadChildren(javax.swing.text.ViewFactory) definition code for javax.swing.text.WrappedPlainView.loadChildren(javax.swing.text.ViewFactory)

protected void loadChildren(ViewFactory sample code for javax.swing.text.ViewFactory definition code for javax.swing.text.ViewFactory  f)
Loads all of the children to initialize the view. This is called by the setParent method. Subclasses can reimplement this to initialize their child views in a different manner. The default implementation creates a child view for each child element.

Overrides:
loadChildren sample code for javax.swing.text.CompositeView.loadChildren(javax.swing.text.ViewFactory) definition code for javax.swing.text.CompositeView.loadChildren(javax.swing.text.ViewFactory) in class CompositeView sample code for javax.swing.text.CompositeView definition code for javax.swing.text.CompositeView
Parameters:
f - the view factory
See Also:
CompositeView.setParent(javax.swing.text.View) sample code for javax.swing.text.CompositeView.setParent(javax.swing.text.View) definition code for javax.swing.text.CompositeView.setParent(javax.swing.text.View)

nextTabStop sample code for javax.swing.text.WrappedPlainView.nextTabStop(float, int) definition code for javax.swing.text.WrappedPlainView.nextTabStop(float, int)

public float nextTabStop(float x,
                         int tabOffset)
Returns the next tab stop position after a given reference position. This implementation does not support things like centering so it ignores the tabOffset argument.

Specified by:
nextTabStop sample code for javax.swing.text.TabExpander.nextTabStop(float, int) definition code for javax.swing.text.TabExpander.nextTabStop(float, int) in interface TabExpander sample code for javax.swing.text.TabExpander definition code for javax.swing.text.TabExpander
Parameters:
x - the current position >= 0
tabOffset - the position within the text stream that the tab occurred at >= 0.
Returns:
the tab stop, measured in points >= 0

paint sample code for javax.swing.text.WrappedPlainView.paint(java.awt.Graphics, java.awt.Shape) definition code for javax.swing.text.WrappedPlainView.paint(java.awt.Graphics, java.awt.Shape)

public void paint(Graphics sample code for java.awt.Graphics definition code for java.awt.Graphics  g,
                  Shape sample code for java.awt.Shape definition code for java.awt.Shape  a)
Renders using the given rendering surface and area on that surface. This is implemented to stash the selection positions, selection colors, and font metrics for the nested lines to use.

Overrides:
paint sample code for javax.swing.text.BoxView.paint(java.awt.Graphics, java.awt.Shape) definition code for javax.swing.text.BoxView.paint(java.awt.Graphics, java.awt.Shape) in class BoxView sample code for javax.swing.text.BoxView definition code for javax.swing.text.BoxView
Parameters:
g - the rendering surface to use
a - the allocated region to render into
See Also:
View.paint(java.awt.Graphics, java.awt.Shape) sample code for javax.swing.text.View.paint(java.awt.Graphics, java.awt.Shape) definition code for javax.swing.text.View.paint(java.awt.Graphics, java.awt.Shape)

setSize sample code for javax.swing.text.WrappedPlainView.setSize(float, float) definition code for javax.swing.text.WrappedPlainView.setSize(float, float)

public void setSize(float width,
                    float height)
Sets the size of the view. This should cause layout of the view along the given axis, if it has any layout duties.

Overrides:
setSize sample code for javax.swing.text.BoxView.setSize(float, float) definition code for javax.swing.text.BoxView.setSize(float, float) in class BoxView sample code for javax.swing.text.BoxView definition code for javax.swing.text.BoxView
Parameters:
width - the width >= 0
height - the height >= 0

getPreferredSpan sample code for javax.swing.text.WrappedPlainView.getPreferredSpan(int) definition code for javax.swing.text.WrappedPlainView.getPreferredSpan(int)

public float getPreferredSpan(int axis)
Determines the preferred span for this view along an axis. This is implemented to provide the superclass behavior after first making sure that the current font metrics are cached (for the nested lines which use the metrics to determine the height of the potentially wrapped lines).

Overrides:
getPreferredSpan sample code for javax.swing.text.BoxView.getPreferredSpan(int) definition code for javax.swing.text.BoxView.getPreferredSpan(int) in class BoxView sample code for javax.swing.text.BoxView definition code for javax.swing.text.BoxView
Parameters:
axis - may be either View.X_AXIS or View.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:
View.getPreferredSpan(int) sample code for javax.swing.text.View.getPreferredSpan(int) definition code for javax.swing.text.View.getPreferredSpan(int)

getMinimumSpan sample code for javax.swing.text.WrappedPlainView.getMinimumSpan(int) definition code for javax.swing.text.WrappedPlainView.getMinimumSpan(int)

public float getMinimumSpan(int axis)
Determines the minimum span for this view along an axis. This is implemented to provide the superclass behavior after first making sure that the current font metrics are cached (for the nested lines which use the metrics to determine the height of the potentially wrapped lines).

Overrides:
getMinimumSpan sample code for javax.swing.text.BoxView.getMinimumSpan(int) definition code for javax.swing.text.BoxView.getMinimumSpan(int) in class BoxView sample code for javax.swing.text.BoxView definition code for javax.swing.text.BoxView
Parameters:
axis - may be either View.X_AXIS or View.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:
View.getMinimumSpan(int) sample code for javax.swing.text.View.getMinimumSpan(int) definition code for javax.swing.text.View.getMinimumSpan(int)

getMaximumSpan sample code for javax.swing.text.WrappedPlainView.getMaximumSpan(int) definition code for javax.swing.text.WrappedPlainView.getMaximumSpan(int)

public float getMaximumSpan(int axis)
Determines the maximum span for this view along an axis. This is implemented to provide the superclass behavior after first making sure that the current font metrics are cached (for the nested lines which use the metrics to determine the height of the potentially wrapped lines).

Overrides:
getMaximumSpan sample code for javax.swing.text.BoxView.getMaximumSpan(int) definition code for javax.swing.text.BoxView.getMaximumSpan(int) in class BoxView sample code for javax.swing.text.BoxView definition code for javax.swing.text.BoxView
Parameters:
axis - may be either View.X_AXIS or View.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:
View.getMaximumSpan(int) sample code for javax.swing.text.View.getMaximumSpan(int) definition code for javax.swing.text.View.getMaximumSpan(int)

insertUpdate sample code for javax.swing.text.WrappedPlainView.insertUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory) definition code for javax.swing.text.WrappedPlainView.insertUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory)

public void insertUpdate(DocumentEvent sample code for javax.swing.event.DocumentEvent definition code for javax.swing.event.DocumentEvent  e,
                         Shape sample code for java.awt.Shape definition code for java.awt.Shape  a,
                         ViewFactory sample code for javax.swing.text.ViewFactory definition code for javax.swing.text.ViewFactory  f)
Gives notification that something was inserted into the document in a location that this view is responsible for. This is implemented to simply update the children.

Overrides:
insertUpdate sample code for javax.swing.text.View.insertUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory) definition code for javax.swing.text.View.insertUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory) in class View sample code for javax.swing.text.View definition code for javax.swing.text.View
Parameters:
e - the change information from the associated document
a - the current allocation of the view
f - the factory to use to rebuild if the view has children
See Also:
View.insertUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory) sample code for javax.swing.text.View.insertUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory) definition code for javax.swing.text.View.insertUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory)

removeUpdate sample code for javax.swing.text.WrappedPlainView.removeUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory) definition code for javax.swing.text.WrappedPlainView.removeUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory)

public void removeUpdate(DocumentEvent sample code for javax.swing.event.DocumentEvent definition code for javax.swing.event.DocumentEvent  e,
                         Shape sample code for java.awt.Shape definition code for java.awt.Shape  a,
                         ViewFactory sample code for javax.swing.text.ViewFactory definition code for javax.swing.text.ViewFactory  f)
Gives notification that something was removed from the document in a location that this view is responsible for. This is implemented to simply update the children.

Overrides:
removeUpdate sample code for javax.swing.text.View.removeUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory) definition code for javax.swing.text.View.removeUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory) in class View sample code for javax.swing.text.View definition code for javax.swing.text.View
Parameters:
e - the change information from the associated document
a - the current allocation of the view
f - the factory to use to rebuild if the view has children
See Also:
View.removeUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory) sample code for javax.swing.text.View.removeUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory) definition code for javax.swing.text.View.removeUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory)

changedUpdate sample code for javax.swing.text.WrappedPlainView.changedUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory) definition code for javax.swing.text.WrappedPlainView.changedUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory)

public void changedUpdate(DocumentEvent sample code for javax.swing.event.DocumentEvent definition code for javax.swing.event.DocumentEvent  e,
                          Shape sample code for java.awt.Shape definition code for java.awt.Shape  a,
                          ViewFactory sample code for javax.swing.text.ViewFactory definition code for javax.swing.text.ViewFactory  f)
Gives notification from the document that attributes were changed in a location that this view is responsible for.

Overrides:
changedUpdate sample code for javax.swing.text.View.changedUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory) definition code for javax.swing.text.View.changedUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory) in class View sample code for javax.swing.text.View definition code for javax.swing.text.View
Parameters:
e - the change information from the associated document
a - the current allocation of the view
f - the factory to use to rebuild if the view has children
See Also:
View.changedUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory) sample code for javax.swing.text.View.changedUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory) definition code for javax.swing.text.View.changedUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory)