All Packages Class Hierarchy This Package Previous Next Index
Class com.sun.java.swing.text.LabelView
java.lang.Object
|
+----com.sun.java.swing.text.View
|
+----com.sun.java.swing.text.LabelView
- public class LabelView
- extends View
- implements TabExpander
Styled chunk of text that represents a view mapped over a
text model.
-
LabelView(Element)
- Constructs a new view wrapped on an element.
-
LabelView(Element, int, int)
- Constructs a new view wrapped on an element.
-
breakView(int, float, Shape)
- Breaks this view on the given axis at the given length.
-
changedUpdate(DocumentEvent, Shape, ViewFactory)
- Gives notification from the document that attributes were changed
in a location that this view is responsible for.
-
getAlignment(int)
- Determines the desired alignment for this view along an
axis.
-
getBreakPenalty(int, float)
- Determines the penalty for breaking the view.
-
getEndOffset()
- Fetches the portion of the model that this view is responsible for.
-
getPreferredSpan(int)
- Determines the preferred span for this view along an
axis.
-
getStartOffset()
- Fetches the portion of the model that this view is responsible for.
-
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)
- 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)
- Renders a portion of a text style run.
-
removeUpdate(DocumentEvent, Shape, ViewFactory)
- Gives notification that something was removed from the document
in a location that this view is responsible for.
-
viewToModel(float, float, Shape)
- Provides a mapping from the view coordinate space to the logical
coordinate space of the model.
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
LabelView
public LabelView(Element elem)
- Constructs a new view wrapped on an element.
- Parameters:
- elem - the element
nextTabStop
public float nextTabStop(float x)
- Returns the next tab stop position given a reference position
- Parameters:
- x - the position
- Returns:
- the tab stop
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
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
- Returns:
- s 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.
- Overrides:
- getPreferredSpan in class View
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
- Returns:
- s the desired alignment. This should be a value
between 0.0 and 1.0 where 0 indicates alignment at the
origin and 1.0 indicates alignment to the full span
away from the origin. An alignment of 0.5 would be the
center of the view.
- Overrides:
- getAlignment in class View
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
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
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
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
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
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
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
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
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