javax.swing.text
Class AsyncBoxView

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by javax.swing.text.View sample code for javax.swing.text.View definition code for javax.swing.text.View 
      extended by javax.swing.text.AsyncBoxView
All Implemented Interfaces:
SwingConstants sample code for javax.swing.SwingConstants definition code for javax.swing.SwingConstants

public class AsyncBoxView
extends View sample code for javax.swing.text.View definition code for javax.swing.text.View

A box that does layout asynchronously. This is useful to keep the GUI event thread moving by not doing any layout on it. The layout is done on a granularity of operations on the child views. After each child view is accessed for some part of layout (a potentially time consuming operation) the remaining tasks can be abandoned or a new higher priority task (i.e. to service a synchronous request or a visible area) can be taken on.

While the child view is being accessed a read lock is aquired on the associated document so that the model is stable while being accessed.

Since:
1.3

Nested Class Summary
 class AsyncBoxView.ChildLocator sample code for javax.swing.text.AsyncBoxView.ChildLocator definition code for javax.swing.text.AsyncBoxView.ChildLocator
          A class to manage the effective position of the child views in a localized area while changes are being made around the localized area.
 class AsyncBoxView.ChildState sample code for javax.swing.text.AsyncBoxView.ChildState definition code for javax.swing.text.AsyncBoxView.ChildState
          A record representing the layout state of a child view.
 
Field Summary
protected  AsyncBoxView.ChildLocator sample code for javax.swing.text.AsyncBoxView.ChildLocator definition code for javax.swing.text.AsyncBoxView.ChildLocator locator sample code for javax.swing.text.AsyncBoxView.locator definition code for javax.swing.text.AsyncBoxView.locator
          Object that manages the offsets of the children.
 
Fields inherited from class javax.swing.text.View sample code for javax.swing.text.View definition code for javax.swing.text.View
BadBreakWeight sample code for javax.swing.text.View.BadBreakWeight definition code for javax.swing.text.View.BadBreakWeight , ExcellentBreakWeight sample code for javax.swing.text.View.ExcellentBreakWeight definition code for javax.swing.text.View.ExcellentBreakWeight , ForcedBreakWeight sample code for javax.swing.text.View.ForcedBreakWeight definition code for javax.swing.text.View.ForcedBreakWeight , GoodBreakWeight sample code for javax.swing.text.View.GoodBreakWeight definition code for javax.swing.text.View.GoodBreakWeight , X_AXIS sample code for javax.swing.text.View.X_AXIS definition code for javax.swing.text.View.X_AXIS , Y_AXIS sample code for javax.swing.text.View.Y_AXIS definition code for javax.swing.text.View.Y_AXIS
 
Fields inherited from interface javax.swing.SwingConstants sample code for javax.swing.SwingConstants definition code for javax.swing.SwingConstants
BOTTOM sample code for javax.swing.SwingConstants.BOTTOM definition code for javax.swing.SwingConstants.BOTTOM , CENTER sample code for javax.swing.SwingConstants.CENTER definition code for javax.swing.SwingConstants.CENTER , EAST sample code for javax.swing.SwingConstants.EAST definition code for javax.swing.SwingConstants.EAST , HORIZONTAL sample code for javax.swing.SwingConstants.HORIZONTAL definition code for javax.swing.SwingConstants.HORIZONTAL , LEADING sample code for javax.swing.SwingConstants.LEADING definition code for javax.swing.SwingConstants.LEADING , LEFT sample code for javax.swing.SwingConstants.LEFT definition code for javax.swing.SwingConstants.LEFT , NEXT sample code for javax.swing.SwingConstants.NEXT definition code for javax.swing.SwingConstants.NEXT , NORTH sample code for javax.swing.SwingConstants.NORTH definition code for javax.swing.SwingConstants.NORTH , NORTH_EAST sample code for javax.swing.SwingConstants.NORTH_EAST definition code for javax.swing.SwingConstants.NORTH_EAST , NORTH_WEST sample code for javax.swing.SwingConstants.NORTH_WEST definition code for javax.swing.SwingConstants.NORTH_WEST , PREVIOUS sample code for javax.swing.SwingConstants.PREVIOUS definition code for javax.swing.SwingConstants.PREVIOUS , RIGHT sample code for javax.swing.SwingConstants.RIGHT definition code for javax.swing.SwingConstants.RIGHT , SOUTH sample code for javax.swing.SwingConstants.SOUTH definition code for javax.swing.SwingConstants.SOUTH , SOUTH_EAST sample code for javax.swing.SwingConstants.SOUTH_EAST definition code for javax.swing.SwingConstants.SOUTH_EAST , SOUTH_WEST sample code for javax.swing.SwingConstants.SOUTH_WEST definition code for javax.swing.SwingConstants.SOUTH_WEST , TOP sample code for javax.swing.SwingConstants.TOP definition code for javax.swing.SwingConstants.TOP , TRAILING sample code for javax.swing.SwingConstants.TRAILING definition code for javax.swing.SwingConstants.TRAILING , VERTICAL sample code for javax.swing.SwingConstants.VERTICAL definition code for javax.swing.SwingConstants.VERTICAL , WEST sample code for javax.swing.SwingConstants.WEST definition code for javax.swing.SwingConstants.WEST
 
Constructor Summary
AsyncBoxView sample code for javax.swing.text.AsyncBoxView.AsyncBoxView(javax.swing.text.Element, int) definition code for javax.swing.text.AsyncBoxView.AsyncBoxView(javax.swing.text.Element, int) (Element sample code for javax.swing.text.Element definition code for javax.swing.text.Element  elem, int axis)
          Construct a box view that does asynchronous layout.
 
Method Summary
protected  AsyncBoxView.ChildState sample code for javax.swing.text.AsyncBoxView.ChildState definition code for javax.swing.text.AsyncBoxView.ChildState createChildState sample code for javax.swing.text.AsyncBoxView.createChildState(javax.swing.text.View) definition code for javax.swing.text.AsyncBoxView.createChildState(javax.swing.text.View) (View sample code for javax.swing.text.View definition code for javax.swing.text.View  v)
          New ChildState records are created through this method to allow subclasses the extend the ChildState records to do/hold more
protected  void flushRequirementChanges sample code for javax.swing.text.AsyncBoxView.flushRequirementChanges() definition code for javax.swing.text.AsyncBoxView.flushRequirementChanges() ()
          Publish the changes in preferences upward to the parent view.
 float getBottomInset sample code for javax.swing.text.AsyncBoxView.getBottomInset() definition code for javax.swing.text.AsyncBoxView.getBottomInset() ()
          Get the bottom part of the margin around the view.
 Shape sample code for java.awt.Shape definition code for java.awt.Shape getChildAllocation sample code for javax.swing.text.AsyncBoxView.getChildAllocation(int, java.awt.Shape) definition code for javax.swing.text.AsyncBoxView.getChildAllocation(int, java.awt.Shape) (int index, Shape sample code for java.awt.Shape definition code for java.awt.Shape  a)
          Fetches the allocation for the given child view.
protected  AsyncBoxView.ChildState sample code for javax.swing.text.AsyncBoxView.ChildState definition code for javax.swing.text.AsyncBoxView.ChildState getChildState sample code for javax.swing.text.AsyncBoxView.getChildState(int) definition code for javax.swing.text.AsyncBoxView.getChildState(int) (int index)
          Fetch the object representing the layout state of of the child at the given index.
protected  boolean getEstimatedMajorSpan sample code for javax.swing.text.AsyncBoxView.getEstimatedMajorSpan() definition code for javax.swing.text.AsyncBoxView.getEstimatedMajorSpan() ()
          Is the major span currently estimated?
protected  float getInsetSpan sample code for javax.swing.text.AsyncBoxView.getInsetSpan(int) definition code for javax.swing.text.AsyncBoxView.getInsetSpan(int) (int axis)
          Fetch the span along an axis that is taken up by the insets.
protected  LayoutQueue sample code for javax.swing.text.LayoutQueue definition code for javax.swing.text.LayoutQueue getLayoutQueue sample code for javax.swing.text.AsyncBoxView.getLayoutQueue() definition code for javax.swing.text.AsyncBoxView.getLayoutQueue() ()
          Fetch the queue to use for layout.
 float getLeftInset sample code for javax.swing.text.AsyncBoxView.getLeftInset() definition code for javax.swing.text.AsyncBoxView.getLeftInset() ()
          Get the left part of the margin around the view.
 int getMajorAxis sample code for javax.swing.text.AsyncBoxView.getMajorAxis() definition code for javax.swing.text.AsyncBoxView.getMajorAxis() ()
          Fetch the major axis (the axis the children are tiled along).
 float getMaximumSpan sample code for javax.swing.text.AsyncBoxView.getMaximumSpan(int) definition code for javax.swing.text.AsyncBoxView.getMaximumSpan(int) (int axis)
          Determines the maximum span for this view along an axis.
 float getMinimumSpan sample code for javax.swing.text.AsyncBoxView.getMinimumSpan(int) definition code for javax.swing.text.AsyncBoxView.getMinimumSpan(int) (int axis)
          Determines the minimum span for this view along an axis.
 int getMinorAxis sample code for javax.swing.text.AsyncBoxView.getMinorAxis() definition code for javax.swing.text.AsyncBoxView.getMinorAxis() ()
          Fetch the minor axis (the axis orthoginal to the tiled axis).
 int getNextVisualPositionFrom sample code for javax.swing.text.AsyncBoxView.getNextVisualPositionFrom(int, javax.swing.text.Position.Bias, java.awt.Shape, int, javax.swing.text.Position.Bias[]) definition code for javax.swing.text.AsyncBoxView.getNextVisualPositionFrom(int, javax.swing.text.Position.Bias, java.awt.Shape, int, javax.swing.text.Position.Bias[]) (int pos, Position.Bias sample code for javax.swing.text.Position.Bias definition code for javax.swing.text.Position.Bias  b, Shape sample code for java.awt.Shape definition code for java.awt.Shape  a, int direction, Position.Bias sample code for javax.swing.text.Position.Bias definition code for javax.swing.text.Position.Bias [] biasRet)
          Provides a way to determine the next visually represented model location that one might place a caret.
 float getPreferredSpan sample code for javax.swing.text.AsyncBoxView.getPreferredSpan(int) definition code for javax.swing.text.AsyncBoxView.getPreferredSpan(int) (int axis)
          Determines the preferred span for this view along an axis.
 float getRightInset sample code for javax.swing.text.AsyncBoxView.getRightInset() definition code for javax.swing.text.AsyncBoxView.getRightInset() ()
          Get the right part of the margin around the view.
 float getTopInset sample code for javax.swing.text.AsyncBoxView.getTopInset() definition code for javax.swing.text.AsyncBoxView.getTopInset() ()
          Get the top part of the margin around the view.
 View sample code for javax.swing.text.View definition code for javax.swing.text.View getView sample code for javax.swing.text.AsyncBoxView.getView(int) definition code for javax.swing.text.AsyncBoxView.getView(int) (int n)
          Gets the nth child view.
 int getViewCount sample code for javax.swing.text.AsyncBoxView.getViewCount() definition code for javax.swing.text.AsyncBoxView.getViewCount() ()
          Returns the number of views in this view.
 int getViewIndex sample code for javax.swing.text.AsyncBoxView.getViewIndex(int, javax.swing.text.Position.Bias) definition code for javax.swing.text.AsyncBoxView.getViewIndex(int, javax.swing.text.Position.Bias) (int pos, Position.Bias sample code for javax.swing.text.Position.Bias definition code for javax.swing.text.Position.Bias  b)
          Returns the child view index representing the given position in the model.
protected  int getViewIndexAtPosition sample code for javax.swing.text.AsyncBoxView.getViewIndexAtPosition(int, javax.swing.text.Position.Bias) definition code for javax.swing.text.AsyncBoxView.getViewIndexAtPosition(int, javax.swing.text.Position.Bias) (int pos, Position.Bias sample code for javax.swing.text.Position.Bias definition code for javax.swing.text.Position.Bias  b)
          Fetches the child view index representing the given position in the model.
protected  void loadChildren sample code for javax.swing.text.AsyncBoxView.loadChildren(javax.swing.text.ViewFactory) definition code for javax.swing.text.AsyncBoxView.loadChildren(javax.swing.text.ViewFactory) (ViewFactory sample code for javax.swing.text.ViewFactory definition code for javax.swing.text.ViewFactory  f)
          Loads all of the children to initialize the view.
protected  void majorRequirementChange sample code for javax.swing.text.AsyncBoxView.majorRequirementChange(javax.swing.text.AsyncBoxView.ChildState, float) definition code for javax.swing.text.AsyncBoxView.majorRequirementChange(javax.swing.text.AsyncBoxView.ChildState, float) (AsyncBoxView.ChildState sample code for javax.swing.text.AsyncBoxView.ChildState definition code for javax.swing.text.AsyncBoxView.ChildState  cs, float delta)
          Requirements changed along the major axis.
protected  void minorRequirementChange sample code for javax.swing.text.AsyncBoxView.minorRequirementChange(javax.swing.text.AsyncBoxView.ChildState) definition code for javax.swing.text.AsyncBoxView.minorRequirementChange(javax.swing.text.AsyncBoxView.ChildState) (AsyncBoxView.ChildState sample code for javax.swing.text.AsyncBoxView.ChildState definition code for javax.swing.text.AsyncBoxView.ChildState  cs)
          Requirements changed along the minor axis.
 Shape sample code for java.awt.Shape definition code for java.awt.Shape modelToView sample code for javax.swing.text.AsyncBoxView.modelToView(int, java.awt.Shape, javax.swing.text.Position.Bias) definition code for javax.swing.text.AsyncBoxView.modelToView(int, java.awt.Shape, javax.swing.text.Position.Bias) (int pos, Shape sample code for java.awt.Shape definition code for java.awt.Shape  a, Position.Bias sample code for javax.swing.text.Position.Bias definition code for javax.swing.text.Position.Bias  b)
          Provides a mapping from the document model coordinate space to the coordinate space of the view mapped to it.
 void paint sample code for javax.swing.text.AsyncBoxView.paint(java.awt.Graphics, java.awt.Shape) definition code for javax.swing.text.AsyncBoxView.paint(java.awt.Graphics, java.awt.Shape) (Graphics sample code for java.awt.Graphics definition code for java.awt.Graphics  g, Shape sample code for java.awt.Shape definition code for java.awt.Shape  alloc)
          Render the view using the given allocation and rendering surface.
 void preferenceChanged sample code for javax.swing.text.AsyncBoxView.preferenceChanged(javax.swing.text.View, boolean, boolean) definition code for javax.swing.text.AsyncBoxView.preferenceChanged(javax.swing.text.View, boolean, boolean) (View sample code for javax.swing.text.View definition code for javax.swing.text.View  child, boolean width, boolean height)
          Child views can call this on the parent to indicate that the preference has changed and should be reconsidered for layout.
 void replace sample code for javax.swing.text.AsyncBoxView.replace(int, int, javax.swing.text.View[]) definition code for javax.swing.text.AsyncBoxView.replace(int, int, javax.swing.text.View[]) (int offset, int length, View sample code for javax.swing.text.View definition code for javax.swing.text.View [] views)
          Calls the superclass to update the child views, and updates the status records for the children.
 void setBottomInset sample code for javax.swing.text.AsyncBoxView.setBottomInset(float) definition code for javax.swing.text.AsyncBoxView.setBottomInset(float) (float i)
          Set the bottom part of the margin around the view.
protected  void setEstimatedMajorSpan sample code for javax.swing.text.AsyncBoxView.setEstimatedMajorSpan(boolean) definition code for javax.swing.text.AsyncBoxView.setEstimatedMajorSpan(boolean) (boolean isEstimated)
          Set the estimatedMajorSpan property that determines if the major span should be treated as being estimated.
 void setLeftInset sample code for javax.swing.text.AsyncBoxView.setLeftInset(float) definition code for javax.swing.text.AsyncBoxView.setLeftInset(float) (float i)
          Set the left part of the margin around the view.
 void setParent sample code for javax.swing.text.AsyncBoxView.setParent(javax.swing.text.View) definition code for javax.swing.text.AsyncBoxView.setParent(javax.swing.text.View) (View sample code for javax.swing.text.View definition code for javax.swing.text.View  parent)
          Sets the parent of the view.
 void setRightInset sample code for javax.swing.text.AsyncBoxView.setRightInset(float) definition code for javax.swing.text.AsyncBoxView.setRightInset(float) (float i)
          Set the right part of the margin around the view.
 void setSize sample code for javax.swing.text.AsyncBoxView.setSize(float, float) definition code for javax.swing.text.AsyncBoxView.setSize(float, float) (float width, float height)
          Sets the size of the view.
 void setTopInset sample code for javax.swing.text.AsyncBoxView.setTopInset(float) definition code for javax.swing.text.AsyncBoxView.setTopInset(float) (float i)
          Set the top part of the margin around the view.
protected  void updateLayout sample code for javax.swing.text.AsyncBoxView.updateLayout(javax.swing.event.DocumentEvent.ElementChange, javax.swing.event.DocumentEvent, java.awt.Shape) definition code for javax.swing.text.AsyncBoxView.updateLayout(javax.swing.event.DocumentEvent.ElementChange, javax.swing.event.DocumentEvent, java.awt.Shape) (DocumentEvent.ElementChange sample code for javax.swing.event.DocumentEvent.ElementChange definition code for javax.swing.event.DocumentEvent.ElementChange  ec, DocumentEvent sample code for javax.swing.event.DocumentEvent definition code for javax.swing.event.DocumentEvent  e, Shape sample code for java.awt.Shape definition code for java.awt.Shape  a)
          Update the layout in response to receiving notification of change from the model.
 int viewToModel sample code for javax.swing.text.AsyncBoxView.viewToModel(float, float, java.awt.Shape, javax.swing.text.Position.Bias[]) definition code for javax.swing.text.AsyncBoxView.viewToModel(float, float, java.awt.Shape, javax.swing.text.Position.Bias[]) (float x, float y, Shape sample code for java.awt.Shape definition code for java.awt.Shape  a, Position.Bias sample code for javax.swing.text.Position.Bias definition code for javax.swing.text.Position.Bias [] biasReturn)
          Provides a mapping from the view coordinate space to the logical coordinate space of the model.
 
Methods inherited from class javax.swing.text.View sample code for javax.swing.text.View definition code for javax.swing.text.View
append sample code for javax.swing.text.View.append(javax.swing.text.View) definition code for javax.swing.text.View.append(javax.swing.text.View) , breakView sample code for javax.swing.text.View.breakView(int, int, float, float) definition code for javax.swing.text.View.breakView(int, int, float, float) , changedUpdate sample code for javax.swing.text.View.changedUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory) definition code for javax.swing.text.View.changedUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory) , createFragment sample code for javax.swing.text.View.createFragment(int, int) definition code for javax.swing.text.View.createFragment(int, int) , forwardUpdate sample code for javax.swing.text.View.forwardUpdate(javax.swing.event.DocumentEvent.ElementChange, javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory) definition code for javax.swing.text.View.forwardUpdate(javax.swing.event.DocumentEvent.ElementChange, javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory) , forwardUpdateToView sample code for javax.swing.text.View.forwardUpdateToView(javax.swing.text.View, javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory) definition code for javax.swing.text.View.forwardUpdateToView(javax.swing.text.View, javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory) , getAlignment sample code for javax.swing.text.View.getAlignment(int) definition code for javax.swing.text.View.getAlignment(int) , getAttributes sample code for javax.swing.text.View.getAttributes() definition code for javax.swing.text.View.getAttributes() , getBreakWeight sample code for javax.swing.text.View.getBreakWeight(int, float, float) definition code for javax.swing.text.View.getBreakWeight(int, float, float) , getContainer sample code for javax.swing.text.View.getContainer() definition code for javax.swing.text.View.getContainer() , getDocument sample code for javax.swing.text.View.getDocument() definition code for javax.swing.text.View.getDocument() , getElement sample code for javax.swing.text.View.getElement() definition code for javax.swing.text.View.getElement() , getEndOffset sample code for javax.swing.text.View.getEndOffset() definition code for javax.swing.text.View.getEndOffset() , getGraphics sample code for javax.swing.text.View.getGraphics() definition code for javax.swing.text.View.getGraphics() , getParent sample code for javax.swing.text.View.getParent() definition code for javax.swing.text.View.getParent() , getResizeWeight sample code for javax.swing.text.View.getResizeWeight(int) definition code for javax.swing.text.View.getResizeWeight(int) , getStartOffset sample code for javax.swing.text.View.getStartOffset() definition code for javax.swing.text.View.getStartOffset() , getToolTipText sample code for javax.swing.text.View.getToolTipText(float, float, java.awt.Shape) definition code for javax.swing.text.View.getToolTipText(float, float, java.awt.Shape) , getViewFactory sample code for javax.swing.text.View.getViewFactory() definition code for javax.swing.text.View.getViewFactory() , getViewIndex sample code for javax.swing.text.View.getViewIndex(float, float, java.awt.Shape) definition code for javax.swing.text.View.getViewIndex(float, float, java.awt.Shape) , insert sample code for javax.swing.text.View.insert(int, javax.swing.text.View) definition code for javax.swing.text.View.insert(int, javax.swing.text.View) , insertUpdate sample code for javax.swing.text.View.insertUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory) definition code for javax.swing.text.View.insertUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory) , isVisible sample code for javax.swing.text.View.isVisible() definition code for javax.swing.text.View.isVisible() , modelToView sample code for javax.swing.text.View.modelToView(int, javax.swing.text.Position.Bias, int, javax.swing.text.Position.Bias, java.awt.Shape) definition code for javax.swing.text.View.modelToView(int, javax.swing.text.Position.Bias, int, javax.swing.text.Position.Bias, java.awt.Shape) , modelToView sample code for javax.swing.text.View.modelToView(int, java.awt.Shape) definition code for javax.swing.text.View.modelToView(int, java.awt.Shape) , remove sample code for javax.swing.text.View.remove(int) definition code for javax.swing.text.View.remove(int) , removeAll sample code for javax.swing.text.View.removeAll() definition code for javax.swing.text.View.removeAll() , removeUpdate sample code for javax.swing.text.View.removeUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory) definition code for javax.swing.text.View.removeUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory) , updateChildren sample code for javax.swing.text.View.updateChildren(javax.swing.event.DocumentEvent.ElementChange, javax.swing.event.DocumentEvent, javax.swing.text.ViewFactory) definition code for javax.swing.text.View.updateChildren(javax.swing.event.DocumentEvent.ElementChange, javax.swing.event.DocumentEvent, javax.swing.text.ViewFactory) , viewToModel sample code for javax.swing.text.View.viewToModel(float, float, java.awt.Shape) definition code for javax.swing.text.View.viewToModel(float, float, java.awt.Shape)
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , toString sample code for java.lang.Object.toString() definition code for java.lang.Object.toString() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Field Detail

locator sample code for javax.swing.text.AsyncBoxView.locator

protected AsyncBoxView.ChildLocator sample code for javax.swing.text.AsyncBoxView.ChildLocator definition code for javax.swing.text.AsyncBoxView.ChildLocator  locator
Object that manages the offsets of the children. All locking for management of child locations is on this object.

Constructor Detail

AsyncBoxView sample code for javax.swing.text.AsyncBoxView(javax.swing.text.Element, int) definition code for javax.swing.text.AsyncBoxView(javax.swing.text.Element, int)

public AsyncBoxView(Element sample code for javax.swing.text.Element definition code for javax.swing.text.Element  elem,
                    int axis)
Construct a box view that does asynchronous layout.

Parameters:
elem - the element of the model to represent
axis - the axis to tile along. This can be either X_AXIS or Y_AXIS.
Method Detail

getMajorAxis sample code for javax.swing.text.AsyncBoxView.getMajorAxis() definition code for javax.swing.text.AsyncBoxView.getMajorAxis()

public int getMajorAxis()
Fetch the major axis (the axis the children are tiled along). This will have a value of either X_AXIS or Y_AXIS.


getMinorAxis sample code for javax.swing.text.AsyncBoxView.getMinorAxis() definition code for javax.swing.text.AsyncBoxView.getMinorAxis()

public int getMinorAxis()
Fetch the minor axis (the axis orthoginal to the tiled axis). This will have a value of either X_AXIS or Y_AXIS.


getTopInset sample code for javax.swing.text.AsyncBoxView.getTopInset() definition code for javax.swing.text.AsyncBoxView.getTopInset()

public float getTopInset()
Get the top part of the margin around the view.


setTopInset sample code for javax.swing.text.AsyncBoxView.setTopInset(float) definition code for javax.swing.text.AsyncBoxView.setTopInset(float)

public void setTopInset(float i)
Set the top part of the margin around the view.

Parameters:
i - the value of the inset

getBottomInset sample code for javax.swing.text.AsyncBoxView.getBottomInset() definition code for javax.swing.text.AsyncBoxView.getBottomInset()

public float getBottomInset()
Get the bottom part of the margin around the view.


setBottomInset sample code for javax.swing.text.AsyncBoxView.setBottomInset(float) definition code for javax.swing.text.AsyncBoxView.setBottomInset(float)

public void setBottomInset(float i)
Set the bottom part of the margin around the view.

Parameters:
i - the value of the inset

getLeftInset sample code for javax.swing.text.AsyncBoxView.getLeftInset() definition code for javax.swing.text.AsyncBoxView.getLeftInset()

public float getLeftInset()
Get the left part of the margin around the view.


setLeftInset sample code for javax.swing.text.AsyncBoxView.setLeftInset(float) definition code for javax.swing.text.AsyncBoxView.setLeftInset(float)

public void setLeftInset(float i)
Set the left part of the margin around the view.

Parameters:
i - the value of the inset

getRightInset sample code for javax.swing.text.AsyncBoxView.getRightInset() definition code for javax.swing.text.AsyncBoxView.getRightInset()

public float getRightInset()
Get the right part of the margin around the view.


setRightInset sample code for javax.swing.text.AsyncBoxView.setRightInset(float) definition code for javax.swing.text.AsyncBoxView.setRightInset(float)

public void setRightInset(float i)
Set the right part of the margin around the view.

Parameters:
i - the value of the inset

getInsetSpan sample code for javax.swing.text.AsyncBoxView.getInsetSpan(int) definition code for javax.swing.text.AsyncBoxView.getInsetSpan(int)

protected float getInsetSpan(int axis)
Fetch the span along an axis that is taken up by the insets.

Parameters:
axis - the axis to determine the total insets along, either X_AXIS or Y_AXIS.
Since:
1.4

setEstimatedMajorSpan sample code for javax.swing.text.AsyncBoxView.setEstimatedMajorSpan(boolean) definition code for javax.swing.text.AsyncBoxView.setEstimatedMajorSpan(boolean)

protected void setEstimatedMajorSpan(boolean isEstimated)
Set the estimatedMajorSpan property that determines if the major span should be treated as being estimated. If this property is true, the value of setSize along the major axis will change the requirements along the major axis and incremental changes will be ignored until all of the children have been updated (which will cause the property to automatically be set to false). If the property is false the value of the majorSpan will be considered to be accurate and incremental changes will be added into the total as they are calculated.

Since:
1.4

getEstimatedMajorSpan sample code for javax.swing.text.AsyncBoxView.getEstimatedMajorSpan() definition code for javax.swing.text.AsyncBoxView.getEstimatedMajorSpan()

protected boolean getEstimatedMajorSpan()
Is the major span currently estimated?

Since:
1.4

getChildState sample code for javax.swing.text.AsyncBoxView.getChildState(int) definition code for javax.swing.text.AsyncBoxView.getChildState(int)

protected AsyncBoxView.ChildState sample code for javax.swing.text.AsyncBoxView.ChildState definition code for javax.swing.text.AsyncBoxView.ChildState  getChildState(int index)
Fetch the object representing the layout state of of the child at the given index.

Parameters:
index - the child index. This should be a value >= 0 and < getViewCount().

getLayoutQueue sample code for javax.swing.text.AsyncBoxView.getLayoutQueue() definition code for javax.swing.text.AsyncBoxView.getLayoutQueue()

protected LayoutQueue sample code for javax.swing.text.LayoutQueue definition code for javax.swing.text.LayoutQueue  getLayoutQueue()
Fetch the queue to use for layout.


createChildState sample code for javax.swing.text.AsyncBoxView.createChildState(javax.swing.text.View) definition code for javax.swing.text.AsyncBoxView.createChildState(javax.swing.text.View)

protected AsyncBoxView.ChildState sample code for javax.swing.text.AsyncBoxView.ChildState definition code for javax.swing.text.AsyncBoxView.ChildState  createChildState(View sample code for javax.swing.text.View definition code for javax.swing.text.View  v)
New ChildState records are created through this method to allow subclasses the extend the ChildState records to do/hold more


majorRequirementChange sample code for javax.swing.text.AsyncBoxView.majorRequirementChange(javax.swing.text.AsyncBoxView.ChildState, float) definition code for javax.swing.text.AsyncBoxView.majorRequirementChange(javax.swing.text.AsyncBoxView.ChildState, float)

protected void majorRequirementChange(AsyncBoxView.ChildState sample code for javax.swing.text.AsyncBoxView.ChildState definition code for javax.swing.text.AsyncBoxView.ChildState  cs,
                                      float delta)
Requirements changed along the major axis. This is called by the thread doing layout for the given ChildState object when it has completed fetching the child views new preferences. Typically this would be the layout thread, but might be the event thread if it is trying to update something immediately (such as to perform a model/view translation).

This is implemented to mark the major axis as having changed so that a future check to see if the requirements need to be published to the parent view will consider the major axis. If the span along the major axis is not estimated, it is updated by the given delta to reflect the incremental change. The delta is ignored if the major span is estimated.


minorRequirementChange sample code for javax.swing.text.AsyncBoxView.minorRequirementChange(javax.swing.text.AsyncBoxView.ChildState) definition code for javax.swing.text.AsyncBoxView.minorRequirementChange(javax.swing.text.AsyncBoxView.ChildState)

protected void minorRequirementChange(AsyncBoxView.ChildState sample code for javax.swing.text.AsyncBoxView.ChildState definition code for javax.swing.text.AsyncBoxView.ChildState  cs)
Requirements changed along the minor axis. This is called by the thread doing layout for the given ChildState object when it has completed fetching the child views new preferences. Typically this would be the layout thread, but might be the GUI thread if it is trying to update something immediately (such as to perform a model/view translation).


flushRequirementChanges sample code for javax.swing.text.AsyncBoxView.flushRequirementChanges() definition code for javax.swing.text.AsyncBoxView.flushRequirementChanges()

protected void flushRequirementChanges()
Publish the changes in preferences upward to the parent view. This is normally called by the layout thread.


replace sample code for javax.swing.text.AsyncBoxView.replace(int, int, javax.swing.text.View[]) definition code for javax.swing.text.AsyncBoxView.replace(int, int, javax.swing.text.View[])

public void replace(int offset,
                    int length,
                    View sample code for javax.swing.text.View definition code for javax.swing.text.View [] views)
Calls the superclass to update the child views, and updates the status records for the children. This is expected to be called while a write lock is held on the model so that interaction with the layout thread will not happen (i.e. the layout thread acquires a read lock before doing anything).

Overrides:
replace sample code for javax.swing.text.View.replace(int, int, javax.swing.text.View[]) definition code for javax.swing.text.View.replace(int, int, javax.swing.text.View[]) in class View sample code for javax.swing.text.View definition code for javax.swing.text.View
Parameters:
offset - the starting offset into the child views >= 0
length - the number of existing views to replace >= 0
views - the child views to insert

loadChildren sample code for javax.swing.text.AsyncBoxView.loadChildren(javax.swing.text.ViewFactory) definition code for javax.swing.text.AsyncBoxView.loadChildren(javax.swing.text.ViewFactory)

protected void loadChildren(ViewFactory sample code for javax.swing.text.ViewFactory definition code for javax.swing.text.ViewFactory  f)
Loads all of the children to initialize the view. This is called by the setParent method. Subclasses can reimplement this to initialize their child views in a different manner. The default implementation creates a child view for each child element.

Normally a write-lock is held on the Document while the children are being changed, which keeps the rendering and layout threads safe. The exception to this is when the view is initialized to represent an existing element (via this method), so it is synchronized to exclude preferenceChanged while we are initializing.

Parameters:
f - the view factory
See Also:
setParent(javax.swing.text.View) sample code for javax.swing.text.AsyncBoxView.setParent(javax.swing.text.View) definition code for javax.swing.text.AsyncBoxView.setParent(javax.swing.text.View)

getViewIndexAtPosition sample code for javax.swing.text.AsyncBoxView.getViewIndexAtPosition(int, javax.swing.text.Position.Bias) definition code for javax.swing.text.AsyncBoxView.getViewIndexAtPosition(int, javax.swing.text.Position.Bias)

protected int getViewIndexAtPosition(int pos,
                                     Position.Bias sample code for javax.swing.text.Position.Bias definition code for javax.swing.text.Position.Bias  b)
Fetches the child view index representing the given position in the model. This is implemented to fetch the view in the case where there is a child view for each child element.

Parameters:
pos - the position >= 0
Returns:
index of the view representing the given position, or -1 if no view represents that position

updateLayout sample code for javax.swing.text.AsyncBoxView.updateLayout(javax.swing.event.DocumentEvent.ElementChange, javax.swing.event.DocumentEvent, java.awt.Shape) definition code for javax.swing.text.AsyncBoxView.updateLayout(javax.swing.event.DocumentEvent.ElementChange, javax.swing.event.DocumentEvent, java.awt.Shape)

protected void updateLayout(DocumentEvent.ElementChange sample code for javax.swing.event.DocumentEvent.ElementChange definition code for javax.swing.event.DocumentEvent.ElementChange  ec,
                            DocumentEvent sample code for javax.swing.event.DocumentEvent definition code for javax.swing.event.DocumentEvent  e,
                            Shape sample code for java.awt.Shape definition code for java.awt.Shape  a)
Update the layout in response to receiving notification of change from the model. This is implemented to note the change on the ChildLocator so that offsets of the children will be correctly computed.

Overrides:
updateLayout sample code for javax.swing.text.View.updateLayout(javax.swing.event.DocumentEvent.ElementChange, javax.swing.event.DocumentEvent, java.awt.Shape) definition code for javax.swing.text.View.updateLayout(javax.swing.event.DocumentEvent.ElementChange, javax.swing.event.DocumentEvent, java.awt.Shape) in class View sample code for javax.swing.text.View definition code for javax.swing.text.View
Parameters:
ec - changes to the element this view is responsible for (may be null if there were no changes).
e - the change information from the associated document
a - the current allocation of the view
See Also:
View.insertUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory) sample code for javax.swing.text.View.insertUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory) definition code for javax.swing.text.View.insertUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory) , View.removeUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory) sample code for javax.swing.text.View.removeUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory) definition code for javax.swing.text.View.removeUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory) , View.changedUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory) sample code for javax.swing.text.View.changedUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory) definition code for javax.swing.text.View.changedUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory)

setParent sample code for javax.swing.text.AsyncBoxView.setParent(javax.swing.text.View) definition code for javax.swing.text.AsyncBoxView.setParent(javax.swing.text.View)

public void setParent(View sample code for javax.swing.text.View definition code for javax.swing.text.View  parent)
Sets the parent of the view. This is reimplemented to provide the superclass behavior as well as calling the loadChildren method if this view does not already have children. The children should not be loaded in the constructor because the act of setting the parent may cause them to try to search up the hierarchy (to get the hosting Container for example). If this view has children (the view is being moved from one place in the view hierarchy to another), the loadChildren method will not be called.

Overrides:
setParent sample code for javax.swing.text.View.setParent(javax.swing.text.View) definition code for javax.swing.text.View.setParent(javax.swing.text.View) in class View sample code for javax.swing.text.View definition code for javax.swing.text.View
Parameters:
parent - the parent of the view, null if none

preferenceChanged sample code for javax.swing.text.AsyncBoxView.preferenceChanged(javax.swing.text.View, boolean, boolean) definition code for javax.swing.text.AsyncBoxView.preferenceChanged(javax.swing.text.View, boolean, boolean)

public void preferenceChanged(View sample code for javax.swing.text.View definition code for javax.swing.text.View  child,
                              boolean width,
                              boolean height)
Child views can call this on the parent to indicate that the preference has changed and should be reconsidered for layout. This is reimplemented to queue new work on the layout thread. This method gets messaged from multiple threads via the children.

Overrides:
preferenceChanged sample code for javax.swing.text.View.preferenceChanged(javax.swing.text.View, boolean, boolean) definition code for javax.swing.text.View.preferenceChanged(javax.swing.text.View, boolean, boolean) in class View sample code for javax.swing.text.View definition code for javax.swing.text.View
Parameters:
child - the child view
width - true if the width preference has changed
height - true if the height preference has changed
See Also:
JComponent.revalidate() sample code for javax.swing.JComponent.revalidate() definition code for javax.swing.JComponent.revalidate()

setSize sample code for javax.swing.text.AsyncBoxView.setSize(float, float) definition code for javax.swing.text.AsyncBoxView.setSize(float, float)

public void setSize(float width,
                    float height)
Sets the size of the view. This should cause layout of the view if the view caches any layout information.

Since the major axis is updated asynchronously and should be the sum of the tiled children the call is ignored for the major axis. Since the minor axis is flexible, work is queued to resize the children if the minor span changes.

Overrides:
setSize sample code for javax.swing.text.View.setSize(float, float) definition code for javax.swing.text.View.setSize(float, float) in class View sample code for javax.swing.text.View definition code for javax.swing.text.View
Parameters:
width - the width >= 0
height - the height >= 0

paint sample code for javax.swing.text.AsyncBoxView.paint(java.awt.Graphics, java.awt.Shape) definition code for javax.swing.text.AsyncBoxView.paint(java.awt.Graphics, java.awt.Shape)

public void paint(Graphics sample code for java.awt.Graphics definition code for java.awt.Graphics  g,
                  Shape sample code for java.awt.Shape definition code for java.awt.Shape  alloc)
Render the view using the given allocation and rendering surface.

This is implemented to determine whether or not the desired region to be rendered (i.e. the unclipped area) is up to date or not. If up-to-date the children are rendered. If not up-to-date, a task to build the desired area is placed on the layout queue as a high priority task. This keeps by event thread moving by rendering if ready, and postponing until a later time if not ready (since paint requests can be rescheduled).

Specified by:
paint sample code for javax.swing.text.View.paint(java.awt.Graphics, java.awt.Shape) definition code for javax.swing.text.View.paint(java.awt.Graphics, java.awt.Shape) in class View sample code for javax.swing.text.View definition code for javax.swing.text.View
Parameters:
g - the rendering surface to use
alloc - the allocated region to render into
See Also:
View.paint(java.awt.Graphics, java.awt.Shape) sample code for javax.swing.text.View.paint(java.awt.Graphics, java.awt.Shape) definition code for javax.swing.text.View.paint(java.awt.Graphics, java.awt.Shape)

getPreferredSpan sample code for javax.swing.text.AsyncBoxView.getPreferredSpan(int) definition code for javax.swing.text.AsyncBoxView.getPreferredSpan(int)

public float getPreferredSpan(int axis)
Determines the preferred span for this view along an axis.

Specified by:
getPreferredSpan sample code for javax.swing.text.View.getPreferredSpan(int) definition code for javax.swing.text.View.getPreferredSpan(int) in class View sample code for javax.swing.text.View definition code for javax.swing.text.View
Parameters:
axis - may be either View.X_AXIS or View.Y_AXIS
Returns:
the span the view would like to be rendered into >= 0. 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.
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - for an invalid axis type
See Also:
View.getPreferredSpan(int) sample code for javax.swing.text.View.getPreferredSpan(int) definition code for javax.swing.text.View.getPreferredSpan(int)

getMinimumSpan sample code for javax.swing.text.AsyncBoxView.getMinimumSpan(int) definition code for javax.swing.text.AsyncBoxView.getMinimumSpan(int)

public float getMinimumSpan(int axis)
Determines the minimum span for this view along an axis.

Overrides:
getMinimumSpan sample code for javax.swing.text.View.getMinimumSpan(int) definition code for javax.swing.text.View.getMinimumSpan(int) in class View sample code for javax.swing.text.View definition code for javax.swing.text.View
Parameters:
axis - may be either View.X_AXIS or View.Y_AXIS
Returns:
the span the view would like to be rendered into >= 0. 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.
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - for an invalid axis type
See Also:
View.getPreferredSpan(int) sample code for javax.swing.text.View.getPreferredSpan(int) definition code for javax.swing.text.View.getPreferredSpan(int)

getMaximumSpan sample code for javax.swing.text.AsyncBoxView.getMaximumSpan(int) definition code for javax.swing.text.AsyncBoxView.getMaximumSpan(int)

public float getMaximumSpan(int axis)
Determines the maximum span for this view along an axis.

Overrides:
getMaximumSpan sample code for javax.swing.text.View.getMaximumSpan(int) definition code for javax.swing.text.View.getMaximumSpan(int) in class View sample code for javax.swing.text.View definition code for javax.swing.text.View
Parameters:
axis - may be either View.X_AXIS or View.Y_AXIS
Returns:
the span the view would like to be rendered into >= 0. 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.
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - for an invalid axis type
See Also:
View.getPreferredSpan(int) sample code for javax.swing.text.View.getPreferredSpan(int) definition code for javax.swing.text.View.getPreferredSpan(int)

getViewCount sample code for javax.swing.text.AsyncBoxView.getViewCount() definition code for javax.swing.text.AsyncBoxView.getViewCount()

public int getViewCount()
Returns the number of views in this view. Since the default is to not be a composite view this returns 0.

Overrides:
getViewCount sample code for javax.swing.text.View.getViewCount() definition code for javax.swing.text.View.getViewCount() in class View sample code for javax.swing.text.View definition code for javax.swing.text.View
Returns:
the number of views >= 0
See Also:
View.getViewCount() sample code for javax.swing.text.View.getViewCount() definition code for javax.swing.text.View.getViewCount()

getView sample code for javax.swing.text.AsyncBoxView.getView(int) definition code for javax.swing.text.AsyncBoxView.getView(int)

public View sample code for javax.swing.text.View definition code for javax.swing.text.View  getView(int n)
Gets the nth child view. Since there are no children by default, this returns null.

Overrides:
getView sample code for javax.swing.text.View.getView(int) definition code for javax.swing.text.View.getView(int) in class View sample code for javax.swing.text.View definition code for javax.swing.text.View
Parameters:
n - the number of the view to get, >= 0 && < getViewCount()
Returns:
the view

getChildAllocation sample code for javax.swing.text.AsyncBoxView.getChildAllocation(int, java.awt.Shape) definition code for javax.swing.text.AsyncBoxView.getChildAllocation(int, java.awt.Shape)

public Shape sample code for java.awt.Shape definition code for java.awt.Shape  getChildAllocation(int index,
                                Shape sample code for java.awt.Shape definition code for java.awt.Shape  a)
Fetches the allocation for the given child view. This enables finding out where various views are located, without assuming the views store their location. This returns null since the default is to not have any child views.

Overrides:
getChildAllocation sample code for javax.swing.text.View.getChildAllocation(int, java.awt.Shape) definition code for javax.swing.text.View.getChildAllocation(int, java.awt.Shape) in class View sample code for javax.swing.text.View definition code for javax.swing.text.View
Parameters:
index - the index of the child, >= 0 && < getViewCount()
a - the allocation to this view.
Returns:
the allocation to the child

getViewIndex sample code for javax.swing.text.AsyncBoxView.getViewIndex(int, javax.swing.text.Position.Bias) definition code for javax.swing.text.AsyncBoxView.getViewIndex(int, javax.swing.text.Position.Bias)

public int getViewIndex(int pos,
                        Position.Bias sample code for javax.swing.text.Position.Bias definition code for javax.swing.text.Position.Bias  b)
Returns the child view index representing the given position in the model. By default a view has no children so this is implemented to return -1 to indicate there is no valid child index for any position.

Overrides:
getViewIndex sample code for javax.swing.text.View.getViewIndex(int, javax.swing.text.Position.Bias) definition code for javax.swing.text.View.getViewIndex(int, javax.swing.text.Position.Bias) in class View sample code for javax.swing.text.View definition code for javax.swing.text.View
Parameters:
pos - the position >= 0
Returns:
index of the view representing the given position, or -1 if no view represents that position
Since:
1.3

modelToView sample code for javax.swing.text.AsyncBoxView.modelToView(int, java.awt.Shape, javax.swing.text.Position.Bias) definition code for javax.swing.text.AsyncBoxView.modelToView(int, java.awt.Shape, javax.swing.text.Position.Bias)

public Shape sample code for java.awt.Shape definition code for java.awt.Shape  modelToView(int pos,
                         Shape sample code for java.awt.Shape definition code for java.awt.Shape  a,
                         Position.Bias sample code for javax.swing.text.Position.Bias definition code for javax.swing.text.Position.Bias  b)
                  throws BadLocationException sample code for javax.swing.text.BadLocationException definition code for javax.swing.text.BadLocationException 
Provides a mapping from the document model coordinate space to the coordinate space of the view mapped to it.

Specified by:
modelToView sample code for javax.swing.text.View.modelToView(int, java.awt.Shape, javax.swing.text.Position.Bias) definition code for javax.swing.text.View.modelToView(int, java.awt.Shape, javax.swing.text.Position.Bias) in class View sample code for javax.swing.text.View definition code for javax.swing.text.View
Parameters:
pos - the position to convert >= 0
a - the allocated region to render into
b - the bias toward the previous character or the next character represented by the offset, in case the position is a boundary of two views.
Returns:
the bounding box of the given position is returned
Throws:
BadLocationException sample code for javax.swing.text.BadLocationException definition code for javax.swing.text.BadLocationException - if the given position does not represent a valid location in the associated document
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - for an invalid bias argument
See Also:
View.viewToModel(float, float, java.awt.Shape, javax.swing.text.Position.Bias[]) sample code for javax.swing.text.View.viewToModel(float, float, java.awt.Shape, javax.swing.text.Position.Bias[]) definition code for javax.swing.text.View.viewToModel(float, float, java.awt.Shape, javax.swing.text.Position.Bias[])

viewToModel sample code for javax.swing.text.AsyncBoxView.viewToModel(float, float, java.awt.Shape, javax.swing.text.Position.Bias[]) definition code for javax.swing.text.AsyncBoxView.viewToModel(float, float, java.awt.Shape, javax.swing.text.Position.Bias[])

public int viewToModel(float x,
                       float y,
                       Shape sample code for java.awt.Shape definition code for java.awt.Shape  a,
                       Position.Bias sample code for javax.swing.text.Position.Bias definition code for javax.swing.text.Position.Bias [] biasReturn)
Provides a mapping from the view coordinate space to the logical coordinate space of the model. The biasReturn argument will be filled in to indicate that the point given is closer to the next character in the model or the previous character in the model.

This is expected to be called by the GUI thread, holding a read-lock on the associated model. It is implemented to locate the child view and determine it's allocation with a lock on the ChildLocator object, and to call viewToModel on the child view with a lock on the ChildState object to avoid interaction with the layout thread.

Specified by:
viewToModel sample code for javax.swing.text.View.viewToModel(float, float, java.awt.Shape, javax.swing.text.Position.Bias[]) definition code for javax.swing.text.View.viewToModel(float, float, java.awt.Shape, javax.swing.text.Position.Bias[]) in class View sample code for javax.swing.text.View definition code for javax.swing.text.View
Parameters:
x - the X coordinate >= 0
y - the Y coordinate >= 0
a - the allocated region to render into
Returns:
the location within the model that best represents the given point in the view >= 0. The biasReturn argument will be filled in to indicate that the point given is closer to the next character in the model or the previous character in the model.

getNextVisualPositionFrom sample code for javax.swing.text.AsyncBoxView.getNextVisualPositionFrom(int, javax.swing.text.Position.Bias, java.awt.Shape, int, javax.swing.text.Position.Bias[]) definition code for javax.swing.text.AsyncBoxView.getNextVisualPositionFrom(int, javax.swing.text.Position.Bias, java.awt.Shape, int, javax.swing.text.Position.Bias[])

public int getNextVisualPositionFrom(int pos,
                                     Position.Bias sample code for javax.swing.text.Position.Bias definition code for javax.swing.text.Position.Bias  b,
                                     Shape sample code for java.awt.Shape definition code for java.awt.Shape  a,
                                     int direction,
                                     Position.Bias sample code for javax.swing.text.Position.Bias definition code for javax.swing.text.Position.Bias [] biasRet)
                              throws BadLocationException sample code for javax.swing.text.BadLocationException definition code for javax.swing.text.BadLocationException 
Provides a way to determine the next visually represented model location that one might place a caret. Some views may not be visible, they might not be in the same order found in the model, or they just might not allow access to some of the locations in the model.

Overrides:
getNextVisualPositionFrom sample code for javax.swing.text.View.getNextVisualPositionFrom(int, javax.swing.text.Position.Bias, java.awt.Shape, int, javax.swing.text.Position.Bias[]) definition code for javax.swing.text.View.getNextVisualPositionFrom(int, javax.swing.text.Position.Bias, java.awt.Shape, int, javax.swing.text.Position.Bias[]) in class View sample code for javax.swing.text.View definition code for javax.swing.text.View
Parameters:
pos - the position to convert >= 0
a - the allocated region to render into
direction - the direction from the current position that can be thought of as the arrow keys typically found on a keyboard; this may be one of the following:
    SwingConstants.WEST SwingConstants.EAST SwingConstants.NORTH SwingConstants.SOUTH
biasRet - an array contain the bias that was checked
Returns:
the location within the model that best represents the next location visual position
Throws:
BadLocationException sample code for javax.swing.text.BadLocationException definition code for javax.swing.text.BadLocationException
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if direction is invalid