All Packages Class Hierarchy This Package Previous Next Index
Class com.sun.java.swing.text.AbstractView
java.lang.Object
|
+----com.sun.java.swing.text.AbstractView
- public abstract class AbstractView
- extends Object
- implements View
Implements some default behavior for the View interface to
simplify creation of new text-oriented views. The implementation
represents an entire element from the model, and claims to be
unbreakable (ie doesn't support breaking behavior).
-
AbstractView(Element)
- Creates a new JView object.
-
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.
-
getBreakPenalty(int, float)
- Determines the penalty for breaking the view.
-
getDocument()
- Fetches the model associated with the view.
-
getElement()
- Fetches the structural portion of the subject that this
view is mapped to.
-
getEndOffset()
- Fetches the portion of the model that this view is
responsible for.
-
getPreferredShape(Shape, ViewFactory)
- Determines the preferred region for this view.
-
getResizePenalty(int, float)
- Determines the penalty for changing the size of the view if it
supports multiple sizes.
-
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, ViewFactory)
- Provides a mapping from the document model coordinate space
to the coordinate space of the view mapped to it.
-
paint(Graphics, Shape, ViewFactory)
- Renders using the given rendering surface and area on that
surface.
-
removeUpdate(DocumentEvent, Shape, ViewFactory)
- Gives notification from the document that attributes were removed
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.
AbstractView
public AbstractView(Element elem)
- Creates a new JView object.
- Parameters:
- elem - the element to represent
getPreferredShape
public abstract Shape getPreferredShape(Shape candidate,
ViewFactory f)
- Determines the preferred region for this view. The candidate
shape may be mutated and used as the return value. The
factory is given because a view may recreate children if
it does layout to satisfy the request.
- Parameters:
- candidate - a region that the parent is considering
allocating to the view. Typically this will be whatever
is left for the parent to allocate.
- 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.
Typically the view is told to render into the shape that
that is returned, although there is no guarantee. The parent
may choose to resize or break the view.
- See Also:
- getPreferredShape
paint
public abstract void paint(Graphics g,
Shape allocation,
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
- See Also:
- paint
modelToView
public abstract 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 is returned
- Throws: BadLocation
- if the given position does not represent a
valid location in the associated document
- See Also:
- modelToView
viewToModel
public abstract 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
- See Also:
- viewToModel
insertUpdate
public abstract void insertUpdate(DocumentEvent e,
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
- See Also:
- insertUpdate
removeUpdate
public abstract void removeUpdate(DocumentEvent e,
Shape a,
ViewFactory f)
- Gives notification from the document that attributes were removed
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
- See Also:
- removeUpdate
changedUpdate
public abstract 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
- See Also:
- changedUpdate
getDocument
public Document getDocument()
- Fetches the model associated with the view.
- Returns:
- the view model
- See Also:
- getDocument
getStartOffset
public int getStartOffset()
- Fetches the portion of the model that this view is
responsible for.
- Returns:
- the starting offset into the model
- 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
- See Also:
- getEndOffset
getElement
public Element getElement()
- Fetches the structural portion of the subject that this
view is mapped to. The view may not be responsible for the
entire portion of the element.
- Returns:
- the subject
- See Also:
- getElement
breakView
public View breakView(int axis,
float len,
Shape a)
- Breaks this view on the given axis at the given length.
- Parameters:
- axis - may be either X_AXIS or Y_AXIS
- len - specifies where a potential break is desired
along the given axis
- a - the current allocation of the view
- Returns:
- the fragment of the view that represents the
given span, if the view can be broken. If the view
doesn't support breaking behavior, null is returned.
- See Also:
- breakView
getBreakPenalty
public int getBreakPenalty(int axis,
float len)
- Determines the penalty for breaking the view.
- Parameters:
- axis - may be either X_AXIS or Y_AXIS
- len - specifies where a potential break is desired
- Returns:
- the penalty
- See Also:
- getBreakPenalty
getResizePenalty
public int getResizePenalty(int axis,
float len)
- Determines the penalty for changing the size of the view if it
supports multiple sizes.
- Parameters:
- axis - may be either X_AXIS or Y_AXIS
- len - specifies where a potential break is desired
- Returns:
- the penalty
- See Also:
- getResizePenalty
All Packages Class Hierarchy This Package Previous Next Index