All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.sun.java.swing.text.LabelView

java.lang.Object
   |
   +----com.sun.java.swing.text.AbstractView
           |
           +----com.sun.java.swing.text.LabelView

public class LabelView
extends AbstractView
implements TabExpander
Styled chunk of text that represents a view mapped over a text model.


Constructor Index

 o LabelView(Element)
Constructs a new view wrapped on an element.
 o LabelView(Element, int, int)
Constructs a new view wrapped on an element.

Method Index

 o breakView(int, float, Shape)
Breaks this view on the given axis at the given length.
 o changedUpdate(DocumentEvent, Shape, ViewFactory)
Gives notification from the document that attributes were changed in a location that this view is responsible for.
 o getBreakPenalty(int, float)
Determines the penalty for breaking the view.
 o getEndOffset()
Fetches the portion of the model that this view is responsible for.
 o getPreferredShape(Shape, ViewFactory)
Calculates the shape of the paragraph.
 o getStartOffset()
Fetches the portion of the model that this view is responsible for.
 o insertUpdate(DocumentEvent, Shape, ViewFactory)
Gives notification that something was inserted into the document in a location that this view is responsible for.
 o modelToView(int, Shape, ViewFactory)
Provides a mapping from the document model coordinate space to the coordinate space of the view mapped to it.
 o nextTabStop(float)
Returns the next tab stop position given a reference position
 o paint(Graphics, Shape, ViewFactory)
Renders a portion of a text style run.
 o removeUpdate(DocumentEvent, Shape, ViewFactory)
Gives notification that something was removed from the document in a location that this view is responsible for.
 o viewToModel(Point, Shape, ViewFactory)
Provides a mapping from the view coordinate space to the logical coordinate space of the model.

Constructors

 o LabelView
 public LabelView(Element elem,
                  int p0,
                  int p1)
Constructs a new view wrapped on an element.

Parameters:
elem - the element
p0 - the beginning of the range
p1 - the end of the range
 o LabelView
 public LabelView(Element elem)
Constructs a new view wrapped on an element.

Parameters:
elem - the element

Methods

 o nextTabStop
 public float nextTabStop(float x)
Returns the next tab stop position given a reference position

 o paint
 public void paint(Graphics g,
                   Shape a,
                   ViewFactory f)
Renders a portion of a text style run.

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
 o getPreferredShape
 public Shape getPreferredShape(Shape candidate,
                                ViewFactory f)
Calculates the shape of the paragraph. The width is basically whatever was given, but the height is calculated based upon the width. If the width has changed, a new height is calculated, otherwise the answer to the size request is cheap as it is simply whatever the last layout produced.

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
 o getStartOffset
 public int getStartOffset()
Fetches the portion of the model that this view is responsible for.

Returns:
the starting offset into the model
Overrides:
getStartOffset in class AbstractView
See Also:
getStartOffset
 o getEndOffset
 public int getEndOffset()
Fetches the portion of the model that this view is responsible for.

Returns:
the ending offset into the model
Overrides:
getEndOffset in class AbstractView
See Also:
getEndOffset
 o 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
 o 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 of view
Overrides:
viewToModel in class AbstractView
See Also:
viewToModel
 o insertUpdate
 public void insertUpdate(DocumentEvent evnt,
                          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
 o removeUpdate
 public void removeUpdate(DocumentEvent evnt,
                          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
 o changedUpdate
 public 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.

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
 o getBreakPenalty
 public int getBreakPenalty(int axis,
                            float len)
Determines the penalty for breaking the view. The view might not support breaking (returns PENALTY_BAD), or the view might insist on being broken (returns PENALTY_GOOD), or it might return some value between the two bounds.

Parameters:
axis - may be either X_AXIS or Y_AXIS
len - specifies where a potential break is desired within the span along the given axis of the allocated area for the view
Returns:
the penalty
Overrides:
getBreakPenalty in class AbstractView
See Also:
getBreakPenalty
 o breakView
 public View breakView(int axis,
                       float span,
                       Shape a)
Breaks this view on the given axis at the given length.

Parameters:
axis - may be either X_AXIS or Y_AXIS
span - specifies where a potential break is desired
a - the current allocation of the view
Returns:
the fragment of the view that represents the given span, if the view can be broken; otherwise null
Overrides:
breakView in class AbstractView
See Also:
breakView

All Packages  Class Hierarchy  This Package  Previous  Next  Index