Class AsyncBoxView.ChildState

java.lang.Object
javax.swing.text.AsyncBoxView.ChildState
All Implemented Interfaces:
Runnable
Enclosing class:
AsyncBoxView

public class AsyncBoxView.ChildState extends Object implements Runnable
A record representing the layout state of a child view. It is runnable as a task on another thread. All access to the child view that is based upon a read-lock on the model should synchronize on this object (i.e. The layout thread and the GUI thread can both have a read lock on the model at the same time and are not protected from each other). Access to a child view hierarchy is serialized via synchronization on the ChildState instance.
Since:
1.3
  • Constructor Summary

    Constructors
    Constructor
    Description
    Construct a child status.
  • Method Summary

    Modifier and Type
    Method
    Description
    Fetch the child view this record represents.
    float
    Get the offset along the major axis.
    float
    What is the span along the major axis.
    float
    What is the offset along the minor axis
    float
    What is the span along the minor axis.
    boolean
    Has the child view been laid out.
    void
    preferenceChanged(boolean width, boolean height)
    Mark preferences changed for this child.
    void
    run()
    Update the child state.
    void
    setMajorOffset(float offs)
    This method should only be called by the ChildLocator, it is simply a convenient place to hold the cached location.

    Methods declared in class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    Modifier and Type
    Method
    Description
    protected Object
    Answers a new instance of the same class as the receiver, whose slots have been filled in with the values in the slots of the receiver.
    boolean
    Compares the argument to the receiver, and answers true if they represent the same object using a class specific comparison.
    protected void
    Deprecated, for removal: This API element is subject to removal in a future version.
    May cause performance issues, deadlocks and hangs.
    final Class<? extends Object>
    Answers the unique instance of java.lang.Class which represents the class of the receiver.
    int
    Answers an integer hash code for the receiver.
    final void
    Causes one thread which is waiting on the receiver to be made ready to run.
    final void
    Causes all threads which are waiting on the receiver to be made ready to run.
    Answers a string containing a concise, human-readable description of the receiver.
    final void
    Causes the thread which sent this message to be made not ready to run pending some change in the receiver (as indicated by notify or notifyAll).
    final void
    wait(long time)
    Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated by notify or notifyAll) or the expiration of the timeout.
    final void
    wait(long time, int frac)
    Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated by notify or notifyAll) or the expiration of the timeout.
  • Constructor Details

    • ChildState

      public ChildState(View v)
      Construct a child status. This needs to start out as fairly large so we don't falsely begin with the idea that all of the children are visible.
      Parameters:
      v - the view
      Since:
      1.4
  • Method Details

    • getChildView

      public View getChildView()
      Fetch the child view this record represents.
      Returns:
      the child view this record represents
    • run

      public void run()
      Update the child state. This should be called by the thread that desires to spend time updating the child state (intended to be the layout thread).

      This acquires a read lock on the associated document for the duration of the update to ensure the model is not changed while it is operating. The first thing to do would be to see if any work actually needs to be done. The following could have conceivably happened while the state was waiting to be updated:

      1. The child may have been removed from the view hierarchy.
      2. The child may have been updated by a higher priority operation (i.e. the child may have become visible).
      Specified by:
      run in interface Runnable
    • getMinorSpan

      public float getMinorSpan()
      What is the span along the minor axis.
      Returns:
      the span along the minor axis
    • getMinorOffset

      public float getMinorOffset()
      What is the offset along the minor axis
      Returns:
      the offset along the minor axis
    • getMajorSpan

      public float getMajorSpan()
      What is the span along the major axis.
      Returns:
      the span along the major axis
    • getMajorOffset

      public float getMajorOffset()
      Get the offset along the major axis.
      Returns:
      the offset along the major axis
    • setMajorOffset

      public void setMajorOffset(float offs)
      This method should only be called by the ChildLocator, it is simply a convenient place to hold the cached location.
      Parameters:
      offs - offsets
    • preferenceChanged

      public void preferenceChanged(boolean width, boolean height)
      Mark preferences changed for this child.
      Parameters:
      width - true if the width preference has changed
      height - true if the height preference has changed
      See Also:
    • isLayoutValid

      public boolean isLayoutValid()
      Has the child view been laid out.
      Returns:
      whether or not the child view been laid out.