All Packages  Class Hierarchy  This Package  Previous  Next  Index  

Class java.awt.swing.text.LabelView

java.lang.Object
    |
    +----java.awt.swing.text.View
            |
            +----java.awt.swing.text.LabelView

public class LabelView
extends View
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 getAlignment(int)
Determines the desired alignment for this view along an axis.
 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 getPreferredSpan(int)
Determines the preferred span for this view along an axis.
 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)
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)
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(float, float, Shape)
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

Parameters:
x - the position
Returns:
the tab stop
 o paint
public void paint(Graphics g,
                  Shape a)
Renders a portion of a text style run.

Parameters:
g - the rendering surface to use
a - the allocated region to render into
Overrides:
paint in class View
 o getPreferredSpan
public float getPreferredSpan(int axis)
Determines the preferred span for this view along an axis.

Parameters:
axis - may be either X_AXIS or Y_AXIS
Overrides:
getPreferredSpan in class View
 o getAlignment
public float getAlignment(int axis)
Determines the desired alignment for this view along an axis. For the label, the alignment is along the font baseline for the y axis, and the superclasses alignment along the x axis.

Parameters:
axis - may be either X_AXIS or Y_AXIS
Overrides:
getAlignment in class View
 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 View
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 View
See Also:
getEndOffset
 o modelToView
public Shape modelToView(int pos,
                         Shape a) 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
Returns:
the bounding box of the given position
Throws: BadLocationException
if the given position does not represent a valid location in the associated document
Overrides:
modelToView in class View
See Also:
modelToView
 o viewToModel
public int viewToModel(float x,
                       float y,
                       Shape a)
Provides a mapping from the view coordinate space to the logical coordinate space of the model.

Parameters:
x - the X coordinate
y - the Y coordinate
a - the allocated region to render into
Returns:
the location within the model that best represents the given point of view
Overrides:
viewToModel in class View
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:
evnt - 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 View
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:
evnt - 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 View
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 View
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 View
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 View
See Also:
breakView

All Packages  Class Hierarchy  This Package  Previous  Next  Index  

Submit a bug or feature