All Packages Class Hierarchy This Package Previous Next Index
Class com.sun.java.swing.text.CompositeView
java.lang.Object
|
+----com.sun.java.swing.text.AbstractView
|
+----com.sun.java.swing.text.CompositeView
- public abstract class CompositeView
- extends AbstractView
A view of a text model that has a children
box. If the box is vertical, it might be useful to represent
something like a collection of lines or paragraphs. If the
box is horizontal, it might be used to represent unwrapped
lines.
-
CompositeView(Element)
- Constructs a JCompositeView for the given element.
-
calculateSize(Rectangle, ViewFactory)
- Calculates the size of a bounding box for the union of all
the child views in the container.
-
changedUpdate(DocumentEvent, Shape, ViewFactory)
- Gives notification from the document that attributes were changed
in a location that this view is responsible for.
-
childAllocation(int, Shape, ViewFactory)
- Returns the allocation for a given child.
-
getPreferredShape(Shape, ViewFactory)
- Determines the preferred region for this view.
-
getView(int)
-
Gets the nth view in this container.
-
getViewAtPoint(Point, Rectangle, ViewFactory)
- Fetches the child view at the given point.
-
getViewAtPosition(int, Rectangle, ViewFactory)
-
-
getViewCount()
-
Returns the number of views in this view.
-
insertUpdate(DocumentEvent, Shape, ViewFactory)
- Gives notification that something was inserted into the document
in a location that this view is responsible for.
-
insertView(int, View)
- Inserts a view in the container.
-
invalidate()
- Notes that the desired size has changed.
-
isAfter(Point, Rectangle)
- Tests whether a point is after the rectangle range.
-
isBefore(Point, Rectangle)
- Tests whether a point is before the rectangle range.
-
loadChildren(ViewFactory)
- Loads all of the children for the case
where children are created for each element.
-
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)
- This doesn't actually render anything, but it invalidates
if the allocation has changed.
-
removeAllViews()
- Removes all views from the container.
-
removeUpdate(DocumentEvent, Shape, ViewFactory)
- Gives notification that something was removed from the document
in a location that this view is responsible for.
-
removeView(int)
- Removes a view from the container.
-
shouldNotHappen()
- Called for internal errors.
-
viewToModel(Point, Shape, ViewFactory)
- Provides a mapping from the view coordinate space to the logical
coordinate space of the model.
CompositeView
public CompositeView(Element elem)
- Constructs a JCompositeView for the given element.
- Parameters:
- elem - the element this view is responsible for
loadChildren
protected void loadChildren(ViewFactory f)
- Loads all of the children for the case
where children are created for each element. Subclasses can
call this if it's appropriate for their behavior.
- Parameters:
- f - the view factory
getViewCount
public int getViewCount()
- Returns the number of views in this view.
- Returns:
- the number of views
- See Also:
- getView
invalidate
public void invalidate()
- Notes that the desired size has changed.
getView
public View getView(int n)
- Gets the nth view in this container.
- Parameters:
- n - the number of the view to get
- Returns:
- the view
removeView
public void removeView(int n)
- Removes a view from the container.
- Parameters:
- n - the number of the view to remove
insertView
public void insertView(int n,
View v)
- Inserts a view in the container.
- Parameters:
- n - the position to insert the view at. All elements of equal
or greater index will be shifted forward.
- v - the view
removeAllViews
public void removeAllViews()
- Removes all views from the container.
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 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 allocation,
ViewFactory f)
- This doesn't actually render anything, but it invalidates
if the allocation has changed.
- Parameters:
- g - the rendering surface to use
- allocation - 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 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
- Overrides:
- insertUpdate in class AbstractView
- See Also:
- insertUpdate
removeUpdate
public void removeUpdate(DocumentEvent e,
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 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
calculateSize
protected abstract Dimension calculateSize(Rectangle alloc,
ViewFactory f)
- Calculates the size of a bounding box for the union of all
the child views in the container.
- Parameters:
- alloc - the rectangle
- f - the view factory
isBefore
protected abstract boolean isBefore(Point p,
Rectangle alloc)
- Tests whether a point is before the rectangle range.
- Parameters:
- p - the point
- alloc - the rectangle
- Returns:
- true if the point is before the specified range
isAfter
protected abstract boolean isAfter(Point p,
Rectangle alloc)
- Tests whether a point is after the rectangle range.
- Parameters:
- p - the point
- alloc - the rectangle
- Returns:
- true if the point is after the specified range
getViewAtPoint
protected abstract View getViewAtPoint(Point p,
Rectangle alloc,
ViewFactory f)
- Fetches the child view at the given point.
- Parameters:
- p - the location of the child to fetch
- alloc - the parent's allocation on entry, which should
be changed to the child's allocation on exit
- f - the view factory
- Returns:
- the child view
childAllocation
protected abstract Rectangle childAllocation(int index,
Shape allocation,
ViewFactory f)
- Returns the allocation for a given child.
- Parameters:
- index - the index of the child
- allocation - the shape
- f - the factory
- Returns:
- the allocation
getViewAtPosition
protected View getViewAtPosition(int pos,
Rectangle a,
ViewFactory f)
shouldNotHappen
protected void shouldNotHappen()
- Called for internal errors.
All Packages Class Hierarchy This Package Previous Next Index