- java.lang.Object
-
- javax.swing.text.AsyncBoxView.ChildLocator
-
- Enclosing class:
- AsyncBoxView
public class AsyncBoxView.ChildLocator extends Object
A class to manage the effective position of the child views in a localized area while changes are being made around the localized area. The AsyncBoxView may be continuously changing, but the visible area needs to remain fairly stable until the layout thread decides to publish an update to the parent.- Since:
- 1.3
-
-
Field Summary
Fields Modifier and Type Field and Description protected Rectangle
childAlloc
A shape to use for the child allocation to avoid creating a lot of garbage.protected Rectangle
lastAlloc
The last seen allocation (for repainting when changes are flushed upward).protected AsyncBoxView.ChildState
lastValidOffset
The location of the last offset calculation that is valid.
-
Constructor Summary
Constructors Constructor and Description AsyncBoxView.ChildLocator()
construct a child locator.
-
Method Summary
Methods Modifier and Type Method and Description void
childChanged(AsyncBoxView.ChildState cs)
Notification that a child changed.protected Shape
getChildAllocation(int index)
Fetch the allocation to use for a child view.Shape
getChildAllocation(int index, Shape a)
Fetch the allocation to use for a child view.int
getViewIndexAtPoint(float x, float y, Shape a)
Fetches the child view index at the given point.protected int
getViewIndexAtVisualOffset(float targetOffset)
Locate the view responsible for an offset into the box along the major axis.void
paintChildren(Graphics g)
Paint the children that intersect the clip area.protected void
setAllocation(Shape a)
Copy the currently allocated shape into the Rectangle used to store the current allocation.
-
-
-
Field Detail
-
lastValidOffset
protected AsyncBoxView.ChildState lastValidOffset
The location of the last offset calculation that is valid.
-
lastAlloc
protected Rectangle lastAlloc
The last seen allocation (for repainting when changes are flushed upward).
-
childAlloc
protected Rectangle childAlloc
A shape to use for the child allocation to avoid creating a lot of garbage.
-
-
Constructor Detail
-
AsyncBoxView.ChildLocator
public AsyncBoxView.ChildLocator()
construct a child locator.
-
-
Method Detail
-
childChanged
public void childChanged(AsyncBoxView.ChildState cs)
Notification that a child changed. This can effect whether or not new offset calculations are needed. This is called by a ChildState object that has changed it's major span. This can therefore be called by multiple threads.
-
paintChildren
public void paintChildren(Graphics g)
Paint the children that intersect the clip area.
-
getChildAllocation
public Shape getChildAllocation(int index, Shape a)
Fetch the allocation to use for a child view. This will update the offsets for all children not yet updated before the given index.
-
getViewIndexAtPoint
public int getViewIndexAtPoint(float x, float y, Shape a)
Fetches the child view index at the given point. This is called by the various View methods that need to calculate which child to forward a message to. This should be called by a block synchronized on this object, and would typically be followed with one or more calls to getChildAllocation that should also be in the synchronized block.- Parameters:
x
- the X coordinate >= 0y
- the Y coordinate >= 0a
- the allocation to the View- Returns:
- the nearest child index
-
getChildAllocation
protected Shape getChildAllocation(int index)
Fetch the allocation to use for a child view. This does not update the offsets in the ChildState records.
-
setAllocation
protected void setAllocation(Shape a)
Copy the currently allocated shape into the Rectangle used to store the current allocation. This would be a floating point rectangle in a Java2D-specific implmentation.
-
getViewIndexAtVisualOffset
protected int getViewIndexAtVisualOffset(float targetOffset)
Locate the view responsible for an offset into the box along the major axis. Make sure that offsets are set on the ChildState objects up to the given target span past the desired offset.- Returns:
- index of the view representing the given visual location (targetOffset), or -1 if no view represents that location
-
-
Traduction non disponible
Les API Java ne sont pas encore traduites en français sur l'infobrol. Seule la version anglaise est disponible pour l'instant.
Version en cache
21/11/2024 21:32:59 Cette version de la page est en cache (à la date du 21/11/2024 21:32:59) afin d'accélérer le traitement. Vous pouvez activer le mode utilisateur dans le menu en haut pour afficher la dernère version de la page.Document créé le 31/08/2006, dernière modification le 04/03/2020
Source du document imprimé : https://www.gaudry.be/java-api-rf-javax/swing/text/asyncboxview.childlocator.html
L'infobrol est un site personnel dont le contenu n'engage que moi. Le texte est mis à disposition sous licence CreativeCommons(BY-NC-SA). Plus d'info sur les conditions d'utilisation et sur l'auteur.
Références
Ces références et liens indiquent des documents consultés lors de la rédaction de cette page, ou qui peuvent apporter un complément d'information, mais les auteurs de ces sources ne peuvent être tenus responsables du contenu de cette page.
L'auteur de ce site est seul responsable de la manière dont sont présentés ici les différents concepts, et des libertés qui sont prises avec les ouvrages de référence. N'oubliez pas que vous devez croiser les informations de sources multiples afin de diminuer les risques d'erreurs.