All Packages Class Hierarchy This Package Previous Next Index
Class com.sun.java.swing.text.PlainView
java.lang.Object
|
+----com.sun.java.swing.text.AbstractView
|
+----com.sun.java.swing.text.PlainView
- public class PlainView
- extends AbstractView
- implements TabExpander
Implements View interface for a simple multi-line text view
that has text in one font and color. The view represents each
child element as a line of text.
- See Also:
- View
-
metrics
-
-
PlainView(Element)
- Constructs a new view wrapped on an element.
-
changedUpdate(DocumentEvent, Shape, ViewFactory)
- Gives notification from the document that attributes were changed
in a location that this view is responsible for.
-
drawLine(int, Graphics, int, int)
- Renders a line of text, suppressing whitespace at the end
and exanding any tabs.
-
getLineLimit()
- Returns the max number of characters per line set for the document,
defaulting to 80.
-
getPreferredShape(Shape, ViewFactory)
- Determines the preferred region for this view.
-
getTabSize()
- Returns the tab size set for the document, defaulting to 8.
-
insertUpdate(DocumentEvent, Shape, ViewFactory)
- Gives notification that something was inserted into the document
in a location that this view is responsible for.
-
modelToView(int, Shape, ViewFactory)
- Provides a mapping from the document model coordinate space
to the coordinate space of the view mapped to it.
-
nextTabStop(float)
- Returns the next tab stop position given a reference position.
-
paint(Graphics, Shape, ViewFactory)
- Renders using the given rendering surface and area on that surface.
-
removeUpdate(DocumentEvent, Shape, ViewFactory)
- Gives notification that something was removed from the document
in a location that this view is responsible for.
-
viewToModel(Point, Shape, ViewFactory)
- Provides a mapping from the view coordinate space to the logical
coordinate space of the model.
metrics
protected FontMetrics metrics
PlainView
public PlainView(Element elem)
- Constructs a new view wrapped on an element.
- Parameters:
- elem - the element
getTabSize
protected int getTabSize()
- Returns the tab size set for the document, defaulting to 8.
- Returns:
- the tab size
getLineLimit
protected int getLineLimit()
- Returns the max number of characters per line set for the document,
defaulting to 80.
- Returns:
- the max number
getPreferredShape
public Shape getPreferredShape(Shape candidate,
ViewFactory f)
- Determines the preferred region for this view.
- Parameters:
- candidate - a region that the parent is considering
allocating to the view
- f - a factory that can be used to create child views if a
new layout is needed to determine the desired shape
- Returns:
- the shape the view would like to be rendered into
- Overrides:
- getPreferredShape in class AbstractView
- See Also:
- getPreferredShape
paint
public void paint(Graphics g,
Shape a,
ViewFactory f)
- 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.
- Parameters:
- g - the rendering surface to use
- a - the allocated region to render into
- f - the factory to use if children need to be created
- Overrides:
- paint in class AbstractView
- See Also:
- paint
modelToView
public Shape modelToView(int pos,
Shape a,
ViewFactory f) throws BadLocationException
- Provides a mapping from the document model coordinate space
to the coordinate space of the view mapped to it.
- Parameters:
- pos - the position to convert
- a - the allocated region to render into
- f - the factory to use if children need to be created
- Returns:
- the bounding box of the given position
- Throws: BadLocation
- if the given position does not represent a
valid location in the associated document
- Overrides:
- modelToView in class AbstractView
- See Also:
- modelToView
viewToModel
public int viewToModel(Point pt,
Shape a,
ViewFactory f)
- Provides a mapping from the view coordinate space to the logical
coordinate space of the model.
- Parameters:
- pt - the view location to convert
- a - the allocated region to render into
- f - the factory to use if children need to be created
- Returns:
- the location within the model that best represents the
given point in the view
- Overrides:
- viewToModel in class AbstractView
- See Also:
- viewToModel
insertUpdate
public void insertUpdate(DocumentEvent changes,
Shape a,
ViewFactory f)
- Gives notification that something was inserted into the document
in a location that this view is responsible for.
- 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
- Overrides:
- insertUpdate in class AbstractView
- See Also:
- insertUpdate
removeUpdate
public void removeUpdate(DocumentEvent changes,
Shape a,
ViewFactory f)
- Gives notification that something was removed from the document
in a location that this view is responsible for.
- 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
- Overrides:
- removeUpdate in class AbstractView
- See Also:
- removeUpdate
changedUpdate
public void changedUpdate(DocumentEvent changes,
Shape a,
ViewFactory f)
- Gives notification from the document that attributes were changed
in a location that this view is responsible for.
- 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
- Overrides:
- changedUpdate in class AbstractView
- See Also:
- changedUpdate
nextTabStop
public float nextTabStop(float x)
- Returns the next tab stop position given a reference position.
- Parameters:
- x - the current position
- Returns:
- the tab stop, measured in points
drawLine
protected void drawLine(int lineIndex,
Graphics g,
int x,
int y)
- Renders a line of text, suppressing whitespace at the end
and exanding any tabs.
- Parameters:
- lineIndex - the line to draw
- g - the graphics context
- x - the starting X position
- y - the starting Y position
All Packages Class Hierarchy This Package Previous Next Index