Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

javax.swing.text
Class WrappedPlainView.WrappedLine  view WrappedPlainView.WrappedLine download WrappedPlainView.WrappedLine.java

java.lang.Object
  extended byjavax.swing.text.View
      extended byjavax.swing.text.WrappedPlainView.WrappedLine
All Implemented Interfaces:
javax.swing.SwingConstants
Enclosing class:
WrappedPlainView

class WrappedPlainView.WrappedLine
extends View


Field Summary
(package private)  int numLines
          Used to cache the number of lines for this View
 
Fields 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
WrappedPlainView.WrappedLine(Element elem)
           
 
Method Summary
(package private)  void determineNumLines()
          Calculates the number of logical lines that the Element needs to be displayed and updates the variable numLines accordingly.
 float getPreferredSpan(int axis)
          Determines the preferred span for this view along the given axis.
 void insertUpdate(javax.swing.event.DocumentEvent changes, java.awt.Shape a, ViewFactory f)
          This method is called when something is inserted into the Document that this View is displaying.
 java.awt.Shape modelToView(int pos, java.awt.Shape a, Position.Bias b)
          Provides a mapping from model space to view space.
 void paint(java.awt.Graphics g, java.awt.Shape s)
          Renders this (possibly wrapped) line using the given Graphics object and on the given rendering surface.
 void removeUpdate(javax.swing.event.DocumentEvent changes, java.awt.Shape a, ViewFactory f)
          This method is called when something is removed from the Document that this View is displaying.
(package private)  void updateDamage(java.awt.Rectangle a)
          This method is called from insertUpdate and removeUpdate.
 int viewToModel(float x, float y, java.awt.Shape a, Position.Bias[] b)
          Provides a mapping from view space to model space.
 
Methods inherited from class javax.swing.text.View
append, breakView, changedUpdate, createFragment, dump, dump, 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

numLines

int numLines
Used to cache the number of lines for this View

Constructor Detail

WrappedPlainView.WrappedLine

public WrappedPlainView.WrappedLine(Element elem)
Method Detail

paint

public void paint(java.awt.Graphics g,
                  java.awt.Shape s)
Renders this (possibly wrapped) line using the given Graphics object and on the given rendering surface.

Specified by:
paint in class View

determineNumLines

void determineNumLines()
Calculates the number of logical lines that the Element needs to be displayed and updates the variable numLines accordingly.


getPreferredSpan

public float getPreferredSpan(int axis)
Determines the preferred span for this view along the given axis.

Specified by:
getPreferredSpan in class View

modelToView

public java.awt.Shape modelToView(int pos,
                                  java.awt.Shape a,
                                  Position.Bias b)
                           throws BadLocationException
Provides a mapping from model space to view space.

Specified by:
modelToView in class View

viewToModel

public int viewToModel(float x,
                       float y,
                       java.awt.Shape a,
                       Position.Bias[] b)
Provides a mapping from view space to model space.

Specified by:
viewToModel in class View

updateDamage

void updateDamage(java.awt.Rectangle a)

This method is called from insertUpdate and removeUpdate.

If the number of lines in the document has changed, just repaint the whole thing (note, could improve performance by not repainting anything above the changes). If the number of lines hasn't changed, just repaint the given Rectangle.

Note that the Rectangle argument may be null when the allocation area is empty.


insertUpdate

public void insertUpdate(javax.swing.event.DocumentEvent changes,
                         java.awt.Shape a,
                         ViewFactory f)
This method is called when something is inserted into the Document that this View is displaying.

Overrides:
insertUpdate in class View

removeUpdate

public void removeUpdate(javax.swing.event.DocumentEvent changes,
                         java.awt.Shape a,
                         ViewFactory f)
This method is called when something is removed from the Document that this View is displaying.

Overrides:
removeUpdate in class View