javax.swing.text
Class BoxView

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.CompositeView sample code for javax.swing.text.CompositeView definition code for javax.swing.text.CompositeView 
          extended by javax.swing.text.BoxView
All Implemented Interfaces:
SwingConstants sample code for javax.swing.SwingConstants definition code for javax.swing.SwingConstants
Direct Known Subclasses:
BlockView sample code for javax.swing.text.html.BlockView definition code for javax.swing.text.html.BlockView , FlowView sample code for javax.swing.text.FlowView definition code for javax.swing.text.FlowView , TableView sample code for javax.swing.text.TableView definition code for javax.swing.text.TableView , TableView.TableCell sample code for javax.swing.text.TableView.TableCell definition code for javax.swing.text.TableView.TableCell , TableView.TableRow sample code for javax.swing.text.TableView.TableRow definition code for javax.swing.text.TableView.TableRow , WrappedPlainView sample code for javax.swing.text.WrappedPlainView definition code for javax.swing.text.WrappedPlainView , ZoneView sample code for javax.swing.text.ZoneView definition code for javax.swing.text.ZoneView

public class BoxView
extends CompositeView sample code for javax.swing.text.CompositeView definition code for javax.swing.text.CompositeView

A view that arranges its children into a box shape by tiling its children along an axis. The box is somewhat like that found in TeX where there is alignment of the children, flexibility of the children is considered, etc. This is a building block that might be useful to represent things like a collection of lines, paragraphs, lists, columns, pages, etc. The axis along which the children are tiled is considered the major axis. The orthoginal axis is the minor axis.

Layout for each axis is handled separately by the methods layoutMajorAxis and layoutMinorAxis. Subclasses can change the layout algorithm by reimplementing these methods. These methods will be called as necessary depending upon whether or not there is cached layout information and the cache is considered valid. These methods are typically called if the given size along the axis changes, or if layoutChanged is called to force an updated layout. The layoutChanged method invalidates cached layout information, if there is any. The requirements published to the parent view are calculated by the methods calculateMajorAxisRequirements and calculateMinorAxisRequirements. If the layout algorithm is changed, these methods will likely need to be reimplemented.


Field Summary
 
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
BoxView sample code for javax.swing.text.BoxView.BoxView(javax.swing.text.Element, int) definition code for javax.swing.text.BoxView.BoxView(javax.swing.text.Element, int) (Element sample code for javax.swing.text.Element definition code for javax.swing.text.Element  elem, int axis)
          Constructs a BoxView.
 
Method Summary
protected  void baselineLayout sample code for javax.swing.text.BoxView.baselineLayout(int, int, int[], int[]) definition code for javax.swing.text.BoxView.baselineLayout(int, int, int[], int[]) (int targetSpan, int axis, int[] offsets, int[] spans)
          Computes the location and extent of each child view in this BoxView given the targetSpan, which is the width (or height) of the region we have to work with.
protected  SizeRequirements sample code for javax.swing.SizeRequirements definition code for javax.swing.SizeRequirements baselineRequirements sample code for javax.swing.text.BoxView.baselineRequirements(int, javax.swing.SizeRequirements) definition code for javax.swing.text.BoxView.baselineRequirements(int, javax.swing.SizeRequirements) (int axis, SizeRequirements sample code for javax.swing.SizeRequirements definition code for javax.swing.SizeRequirements  r)
          Calculates the size requirements for this BoxView by examining the size of each child view.
protected  SizeRequirements sample code for javax.swing.SizeRequirements definition code for javax.swing.SizeRequirements calculateMajorAxisRequirements sample code for javax.swing.text.BoxView.calculateMajorAxisRequirements(int, javax.swing.SizeRequirements) definition code for javax.swing.text.BoxView.calculateMajorAxisRequirements(int, javax.swing.SizeRequirements) (int axis, SizeRequirements sample code for javax.swing.SizeRequirements definition code for javax.swing.SizeRequirements  r)
          Calculates the size requirements for the major axis axis.
protected  SizeRequirements sample code for javax.swing.SizeRequirements definition code for javax.swing.SizeRequirements calculateMinorAxisRequirements sample code for javax.swing.text.BoxView.calculateMinorAxisRequirements(int, javax.swing.SizeRequirements) definition code for javax.swing.text.BoxView.calculateMinorAxisRequirements(int, javax.swing.SizeRequirements) (int axis, SizeRequirements sample code for javax.swing.SizeRequirements definition code for javax.swing.SizeRequirements  r)
          Calculates the size requirements for the minor axis axis.
protected  void childAllocation sample code for javax.swing.text.BoxView.childAllocation(int, java.awt.Rectangle) definition code for javax.swing.text.BoxView.childAllocation(int, java.awt.Rectangle) (int index, Rectangle sample code for java.awt.Rectangle definition code for java.awt.Rectangle  alloc)
          Allocates a region for a child view.
protected  boolean flipEastAndWestAtEnds sample code for javax.swing.text.BoxView.flipEastAndWestAtEnds(int, javax.swing.text.Position.Bias) definition code for javax.swing.text.BoxView.flipEastAndWestAtEnds(int, javax.swing.text.Position.Bias) (int position, Position.Bias sample code for javax.swing.text.Position.Bias definition code for javax.swing.text.Position.Bias  bias)
          Determines in which direction the next view lays.
protected  void forwardUpdate sample code for javax.swing.text.BoxView.forwardUpdate(javax.swing.event.DocumentEvent.ElementChange, javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory) definition code for javax.swing.text.BoxView.forwardUpdate(javax.swing.event.DocumentEvent.ElementChange, javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory) (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, ViewFactory sample code for javax.swing.text.ViewFactory definition code for javax.swing.text.ViewFactory  f)
          Forwards the given DocumentEvent to the child views that need to be notified of the change to the model.
 float getAlignment sample code for javax.swing.text.BoxView.getAlignment(int) definition code for javax.swing.text.BoxView.getAlignment(int) (int axis)
          Determines the desired alignment for this view along an axis.
 int getAxis sample code for javax.swing.text.BoxView.getAxis() definition code for javax.swing.text.BoxView.getAxis() ()
          Fetches the tile axis property.
 Shape sample code for java.awt.Shape definition code for java.awt.Shape getChildAllocation sample code for javax.swing.text.BoxView.getChildAllocation(int, java.awt.Shape) definition code for javax.swing.text.BoxView.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.
 int getHeight sample code for javax.swing.text.BoxView.getHeight() definition code for javax.swing.text.BoxView.getHeight() ()
          Returns the current height of the box.
 float getMaximumSpan sample code for javax.swing.text.BoxView.getMaximumSpan(int) definition code for javax.swing.text.BoxView.getMaximumSpan(int) (int axis)
          Determines the maximum span for this view along an axis.
 float getMinimumSpan sample code for javax.swing.text.BoxView.getMinimumSpan(int) definition code for javax.swing.text.BoxView.getMinimumSpan(int) (int axis)
          Determines the minimum span for this view along an axis.
protected  int getOffset sample code for javax.swing.text.BoxView.getOffset(int, int) definition code for javax.swing.text.BoxView.getOffset(int, int) (int axis, int childIndex)
          Fetches the offset of a particular child's current layout.
 float getPreferredSpan sample code for javax.swing.text.BoxView.getPreferredSpan(int) definition code for javax.swing.text.BoxView.getPreferredSpan(int) (int axis)
          Determines the preferred span for this view along an axis.
 int getResizeWeight sample code for javax.swing.text.BoxView.getResizeWeight(int) definition code for javax.swing.text.BoxView.getResizeWeight(int) (int axis)
          Gets the resize weight.
protected  int getSpan sample code for javax.swing.text.BoxView.getSpan(int, int) definition code for javax.swing.text.BoxView.getSpan(int, int) (int axis, int childIndex)
          Fetches the span of a particular childs current layout.
protected  View sample code for javax.swing.text.View definition code for javax.swing.text.View getViewAtPoint sample code for javax.swing.text.BoxView.getViewAtPoint(int, int, java.awt.Rectangle) definition code for javax.swing.text.BoxView.getViewAtPoint(int, int, java.awt.Rectangle) (int x, int y, Rectangle sample code for java.awt.Rectangle definition code for java.awt.Rectangle  alloc)
          Fetches the child view at the given coordinates.
 int getWidth sample code for javax.swing.text.BoxView.getWidth() definition code for javax.swing.text.BoxView.getWidth() ()
          Returns the current width of the box.
protected  boolean isAfter sample code for javax.swing.text.BoxView.isAfter(int, int, java.awt.Rectangle) definition code for javax.swing.text.BoxView.isAfter(int, int, java.awt.Rectangle) (int x, int y, Rectangle sample code for java.awt.Rectangle definition code for java.awt.Rectangle  innerAlloc)
          Determines if a point falls after an allocated region.
protected  boolean isAllocationValid sample code for javax.swing.text.BoxView.isAllocationValid() definition code for javax.swing.text.BoxView.isAllocationValid() ()
          Are the allocations for the children still valid?
protected  boolean isBefore sample code for javax.swing.text.BoxView.isBefore(int, int, java.awt.Rectangle) definition code for javax.swing.text.BoxView.isBefore(int, int, java.awt.Rectangle) (int x, int y, Rectangle sample code for java.awt.Rectangle definition code for java.awt.Rectangle  innerAlloc)
          Determines if a point falls before an allocated region.
protected  boolean isLayoutValid sample code for javax.swing.text.BoxView.isLayoutValid(int) definition code for javax.swing.text.BoxView.isLayoutValid(int) (int axis)
          Determines if the layout is valid along the given axis.
protected  void layout sample code for javax.swing.text.BoxView.layout(int, int) definition code for javax.swing.text.BoxView.layout(int, int) (int width, int height)
          Perform layout on the box
 void layoutChanged sample code for javax.swing.text.BoxView.layoutChanged(int) definition code for javax.swing.text.BoxView.layoutChanged(int) (int axis)
          Invalidates the layout along an axis.
protected  void layoutMajorAxis sample code for javax.swing.text.BoxView.layoutMajorAxis(int, int, int[], int[]) definition code for javax.swing.text.BoxView.layoutMajorAxis(int, int, int[], int[]) (int targetSpan, int axis, int[] offsets, int[] spans)
          Performs layout for the major axis of the box (i.e.
protected  void layoutMinorAxis sample code for javax.swing.text.BoxView.layoutMinorAxis(int, int, int[], int[]) definition code for javax.swing.text.BoxView.layoutMinorAxis(int, int, int[], int[]) (int targetSpan, int axis, int[] offsets, int[] spans)
          Performs layout for the minor axis of the box (i.e.
 Shape sample code for java.awt.Shape definition code for java.awt.Shape modelToView sample code for javax.swing.text.BoxView.modelToView(int, java.awt.Shape, javax.swing.text.Position.Bias) definition code for javax.swing.text.BoxView.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.BoxView.paint(java.awt.Graphics, java.awt.Shape) definition code for javax.swing.text.BoxView.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  allocation)
          Renders the BoxView using the given rendering surface and area on that surface.
protected  void paintChild sample code for javax.swing.text.BoxView.paintChild(java.awt.Graphics, java.awt.Rectangle, int) definition code for javax.swing.text.BoxView.paintChild(java.awt.Graphics, java.awt.Rectangle, int) (Graphics sample code for java.awt.Graphics definition code for java.awt.Graphics  g, Rectangle sample code for java.awt.Rectangle definition code for java.awt.Rectangle  alloc, int index)
          Paints a child.
 void preferenceChanged sample code for javax.swing.text.BoxView.preferenceChanged(javax.swing.text.View, boolean, boolean) definition code for javax.swing.text.BoxView.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)
          This is called by a child to indicate its preferred span has changed.
 void replace sample code for javax.swing.text.BoxView.replace(int, int, javax.swing.text.View[]) definition code for javax.swing.text.BoxView.replace(int, int, javax.swing.text.View[]) (int index, int length, View sample code for javax.swing.text.View definition code for javax.swing.text.View [] elems)
          Invalidates the layout and resizes the cache of requests/allocations.
 void setAxis sample code for javax.swing.text.BoxView.setAxis(int) definition code for javax.swing.text.BoxView.setAxis(int) (int axis)
          Sets the tile axis property.
 void setSize sample code for javax.swing.text.BoxView.setSize(float, float) definition code for javax.swing.text.BoxView.setSize(float, float) (float width, float height)
          Sets the size of the view.
 int viewToModel sample code for javax.swing.text.BoxView.viewToModel(float, float, java.awt.Shape, javax.swing.text.Position.Bias[]) definition code for javax.swing.text.BoxView.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 [] bias)
          Provides a mapping from the view coordinate space to the logical coordinate space of the model.
 
Methods inherited from class javax.swing.text.CompositeView sample code for javax.swing.text.CompositeView definition code for javax.swing.text.CompositeView
getBottomInset sample code for javax.swing.text.CompositeView.getBottomInset() definition code for javax.swing.text.CompositeView.getBottomInset() , getInsideAllocation sample code for javax.swing.text.CompositeView.getInsideAllocation(java.awt.Shape) definition code for javax.swing.text.CompositeView.getInsideAllocation(java.awt.Shape) , getLeftInset sample code for javax.swing.text.CompositeView.getLeftInset() definition code for javax.swing.text.CompositeView.getLeftInset() , getNextEastWestVisualPositionFrom sample code for javax.swing.text.CompositeView.getNextEastWestVisualPositionFrom(int, javax.swing.text.Position.Bias, java.awt.Shape, int, javax.swing.text.Position.Bias[]) definition code for javax.swing.text.CompositeView.getNextEastWestVisualPositionFrom(int, javax.swing.text.Position.Bias, java.awt.Shape, int, javax.swing.text.Position.Bias[]) , getNextNorthSouthVisualPositionFrom sample code for javax.swing.text.CompositeView.getNextNorthSouthVisualPositionFrom(int, javax.swing.text.Position.Bias, java.awt.Shape, int, javax.swing.text.Position.Bias[]) definition code for javax.swing.text.CompositeView.getNextNorthSouthVisualPositionFrom(int, javax.swing.text.Position.Bias, java.awt.Shape, int, javax.swing.text.Position.Bias[]) , getNextVisualPositionFrom sample code for javax.swing.text.CompositeView.getNextVisualPositionFrom(int, javax.swing.text.Position.Bias, java.awt.Shape, int, javax.swing.text.Position.Bias[]) definition code for javax.swing.text.CompositeView.getNextVisualPositionFrom(int, javax.swing.text.Position.Bias, java.awt.Shape, int, javax.swing.text.Position.Bias[]) , getRightInset sample code for javax.swing.text.CompositeView.getRightInset() definition code for javax.swing.text.CompositeView.getRightInset() , getTopInset sample code for javax.swing.text.CompositeView.getTopInset() definition code for javax.swing.text.CompositeView.getTopInset() , getView sample code for javax.swing.text.CompositeView.getView(int) definition code for javax.swing.text.CompositeView.getView(int) , getViewAtPosition sample code for javax.swing.text.CompositeView.getViewAtPosition(int, java.awt.Rectangle) definition code for javax.swing.text.CompositeView.getViewAtPosition(int, java.awt.Rectangle) , getViewCount sample code for javax.swing.text.CompositeView.getViewCount() definition code for javax.swing.text.CompositeView.getViewCount() , getViewIndex sample code for javax.swing.text.CompositeView.getViewIndex(int, javax.swing.text.Position.Bias) definition code for javax.swing.text.CompositeView.getViewIndex(int, javax.swing.text.Position.Bias) , getViewIndexAtPosition sample code for javax.swing.text.CompositeView.getViewIndexAtPosition(int) definition code for javax.swing.text.CompositeView.getViewIndexAtPosition(int) , loadChildren sample code for javax.swing.text.CompositeView.loadChildren(javax.swing.text.ViewFactory) definition code for javax.swing.text.CompositeView.loadChildren(javax.swing.text.ViewFactory) , modelToView sample code for javax.swing.text.CompositeView.modelToView(int, javax.swing.text.Position.Bias, int, javax.swing.text.Position.Bias, java.awt.Shape) definition code for javax.swing.text.CompositeView.modelToView(int, javax.swing.text.Position.Bias, int, javax.swing.text.Position.Bias, java.awt.Shape) , setInsets sample code for javax.swing.text.CompositeView.setInsets(short, short, short, short) definition code for javax.swing.text.CompositeView.setInsets(short, short, short, short) , setParagraphInsets sample code for javax.swing.text.CompositeView.setParagraphInsets(javax.swing.text.AttributeSet) definition code for javax.swing.text.CompositeView.setParagraphInsets(javax.swing.text.AttributeSet) , setParent sample code for javax.swing.text.CompositeView.setParent(javax.swing.text.View) definition code for javax.swing.text.CompositeView.setParent(javax.swing.text.View)
 
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) , 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) , 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() , 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, 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) , 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) , 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)
 

Constructor Detail

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

public BoxView(Element sample code for javax.swing.text.Element definition code for javax.swing.text.Element  elem,
               int axis)
Constructs a BoxView.

Parameters:
elem - the element this view is responsible for
axis - either View.X_AXIS or View.Y_AXIS
Method Detail

getAxis sample code for javax.swing.text.BoxView.getAxis() definition code for javax.swing.text.BoxView.getAxis()

public int getAxis()
Fetches the tile axis property. This is the axis along which the child views are tiled.

Returns:
the major axis of the box, either View.X_AXIS or View.Y_AXIS
Since:
1.3

setAxis sample code for javax.swing.text.BoxView.setAxis(int) definition code for javax.swing.text.BoxView.setAxis(int)

public void setAxis(int axis)
Sets the tile axis property. This is the axis along which the child views are tiled.

Parameters:
axis - either View.X_AXIS or View.Y_AXIS
Since:
1.3

layoutChanged sample code for javax.swing.text.BoxView.layoutChanged(int) definition code for javax.swing.text.BoxView.layoutChanged(int)

public void layoutChanged(int axis)
Invalidates the layout along an axis. This happens automatically if the preferences have changed for any of the child views. In some cases the layout may need to be recalculated when the preferences have not changed. The layout can be marked as invalid by calling this method. The layout will be updated the next time the setSize method is called on this view (typically in paint).

Parameters:
axis - either View.X_AXIS or View.Y_AXIS
Since:
1.3

isLayoutValid sample code for javax.swing.text.BoxView.isLayoutValid(int) definition code for javax.swing.text.BoxView.isLayoutValid(int)

protected boolean isLayoutValid(int axis)
Determines if the layout is valid along the given axis.

Parameters:
axis - either View.X_AXIS or View.Y_AXIS
Since:
1.4

paintChild sample code for javax.swing.text.BoxView.paintChild(java.awt.Graphics, java.awt.Rectangle, int) definition code for javax.swing.text.BoxView.paintChild(java.awt.Graphics, java.awt.Rectangle, int)

protected void paintChild(Graphics sample code for java.awt.Graphics definition code for java.awt.Graphics  g,
                          Rectangle sample code for java.awt.Rectangle definition code for java.awt.Rectangle  alloc,
                          int index)
Paints a child. By default that is all it does, but a subclass can use this to paint things relative to the child.

Parameters:
g - the graphics context
alloc - the allocated region to paint into
index - the child index, >= 0 && < getViewCount()

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

public void replace(int index,
                    int length,
                    View sample code for javax.swing.text.View definition code for javax.swing.text.View [] elems)
Invalidates the layout and resizes the cache of requests/allocations. The child allocations can still be accessed for the old layout, but the new children will have an offset and span of 0.

Overrides:
replace sample code for javax.swing.text.CompositeView.replace(int, int, javax.swing.text.View[]) definition code for javax.swing.text.CompositeView.replace(int, int, javax.swing.text.View[]) in class CompositeView sample code for javax.swing.text.CompositeView definition code for javax.swing.text.CompositeView
Parameters:
index - the starting index into the child views to insert the new views; this should be a value >= 0 and <= getViewCount
length - the number of existing child views to remove; This should be a value >= 0 and <= (getViewCount() - offset)
elems - the child views to add; this value can be nullto indicate no children are being added (useful to remove)

forwardUpdate sample code for javax.swing.text.BoxView.forwardUpdate(javax.swing.event.DocumentEvent.ElementChange, javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory) definition code for javax.swing.text.BoxView.forwardUpdate(javax.swing.event.DocumentEvent.ElementChange, javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory)

protected void forwardUpdate(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,
                             ViewFactory sample code for javax.swing.text.ViewFactory definition code for javax.swing.text.ViewFactory  f)
Forwards the given DocumentEvent to the child views that need to be notified of the change to the model. If a child changed its requirements and the allocation was valid prior to forwarding the portion of the box from the starting child to the end of the box will be repainted.

Overrides:
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) 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
f - the factory to use to rebuild if the view has children
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)

preferenceChanged sample code for javax.swing.text.BoxView.preferenceChanged(javax.swing.text.View, boolean, boolean) definition code for javax.swing.text.BoxView.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)
This is called by a child to indicate its preferred span has changed. This is implemented to throw away cached layout information so that new calculations will be done the next time the children need an allocation.

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 should change
height - true if the height preference should change
See Also:
JComponent.revalidate() sample code for javax.swing.JComponent.revalidate() definition code for javax.swing.JComponent.revalidate()

getResizeWeight sample code for javax.swing.text.BoxView.getResizeWeight(int) definition code for javax.swing.text.BoxView.getResizeWeight(int)

public int getResizeWeight(int axis)
Gets the resize weight. A value of 0 or less is not resizable.

Overrides:
getResizeWeight sample code for javax.swing.text.View.getResizeWeight(int) definition code for javax.swing.text.View.getResizeWeight(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 weight
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - for an invalid axis

setSize sample code for javax.swing.text.BoxView.setSize(float, float) definition code for javax.swing.text.BoxView.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. This is implemented to call the layout method with the sizes inside of the insets.

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.BoxView.paint(java.awt.Graphics, java.awt.Shape) definition code for javax.swing.text.BoxView.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  allocation)
Renders the BoxView using the given rendering surface and area on that surface. Only the children that intersect the clip bounds of the given Graphics will be rendered.

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
allocation - 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)

getChildAllocation sample code for javax.swing.text.BoxView.getChildAllocation(int, java.awt.Shape) definition code for javax.swing.text.BoxView.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. This is implemented to return null if the layout is invalid, otherwise the superclass behavior is executed.

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

modelToView sample code for javax.swing.text.BoxView.modelToView(int, java.awt.Shape, javax.swing.text.Position.Bias) definition code for javax.swing.text.BoxView.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. This makes sure the allocation is valid before calling the superclass.

Overrides:
modelToView sample code for javax.swing.text.CompositeView.modelToView(int, java.awt.Shape, javax.swing.text.Position.Bias) definition code for javax.swing.text.CompositeView.modelToView(int, java.awt.Shape, javax.swing.text.Position.Bias) in class CompositeView sample code for javax.swing.text.CompositeView definition code for javax.swing.text.CompositeView
Parameters:
pos - the position to convert >= 0
a - the allocated region to render into
b - a bias value of either Position.Bias.Forward or Position.Bias.Backward
Returns:
the bounding box of the given position
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
See Also:
View.modelToView(int, java.awt.Shape, javax.swing.text.Position.Bias) 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)

viewToModel sample code for javax.swing.text.BoxView.viewToModel(float, float, java.awt.Shape, javax.swing.text.Position.Bias[]) definition code for javax.swing.text.BoxView.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 [] bias)
Provides a mapping from the view coordinate space to the logical coordinate space of the model.

Overrides:
viewToModel sample code for javax.swing.text.CompositeView.viewToModel(float, float, java.awt.Shape, javax.swing.text.Position.Bias[]) definition code for javax.swing.text.CompositeView.viewToModel(float, float, java.awt.Shape, javax.swing.text.Position.Bias[]) in class CompositeView sample code for javax.swing.text.CompositeView definition code for javax.swing.text.CompositeView
Parameters:
x - x coordinate of the view location to convert >= 0
y - y coordinate of the view location to convert >= 0
a - the allocated region to render into
bias - either Position.Bias.Forward or Position.Bias.Backward
Returns:
the location within the model that best represents the given point in the view >= 0
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[])

getAlignment sample code for javax.swing.text.BoxView.getAlignment(int) definition code for javax.swing.text.BoxView.getAlignment(int)

public float getAlignment(int axis)
Determines the desired alignment for this view along an axis. This is implemented to give the total alignment needed to position the children with the alignment points lined up along the axis orthoginal to the axis that is being tiled. The axis being tiled will request to be centered (i.e. 0.5f).

Overrides:
getAlignment sample code for javax.swing.text.View.getAlignment(int) definition code for javax.swing.text.View.getAlignment(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 desired alignment >= 0.0f && <= 1.0f; this should be a value between 0.0 and 1.0 where 0 indicates alignment at the origin and 1.0 indicates alignment to the full span away from the origin; an alignment of 0.5 would be the center of the view
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - for an invalid axis

getPreferredSpan sample code for javax.swing.text.BoxView.getPreferredSpan(int) definition code for javax.swing.text.BoxView.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.BoxView.getMinimumSpan(int) definition code for javax.swing.text.BoxView.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.BoxView.getMaximumSpan(int) definition code for javax.swing.text.BoxView.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)

isAllocationValid sample code for javax.swing.text.BoxView.isAllocationValid() definition code for javax.swing.text.BoxView.isAllocationValid()

protected boolean isAllocationValid()
Are the allocations for the children still valid?

Returns:
true if allocations still valid

isBefore sample code for javax.swing.text.BoxView.isBefore(int, int, java.awt.Rectangle) definition code for javax.swing.text.BoxView.isBefore(int, int, java.awt.Rectangle)

protected boolean isBefore(int x,
                           int y,
                           Rectangle sample code for java.awt.Rectangle definition code for java.awt.Rectangle  innerAlloc)
Determines if a point falls before an allocated region.

Specified by:
isBefore sample code for javax.swing.text.CompositeView.isBefore(int, int, java.awt.Rectangle) definition code for javax.swing.text.CompositeView.isBefore(int, int, java.awt.Rectangle) in class CompositeView sample code for javax.swing.text.CompositeView definition code for javax.swing.text.CompositeView
Parameters:
x - the X coordinate >= 0
y - the Y coordinate >= 0
innerAlloc - the allocated region; this is the area inside of the insets
Returns:
true if the point lies before the region else false

isAfter sample code for javax.swing.text.BoxView.isAfter(int, int, java.awt.Rectangle) definition code for javax.swing.text.BoxView.isAfter(int, int, java.awt.Rectangle)

protected boolean isAfter(int x,
                          int y,
                          Rectangle sample code for java.awt.Rectangle definition code for java.awt.Rectangle  innerAlloc)
Determines if a point falls after an allocated region.

Specified by:
isAfter sample code for javax.swing.text.CompositeView.isAfter(int, int, java.awt.Rectangle) definition code for javax.swing.text.CompositeView.isAfter(int, int, java.awt.Rectangle) in class CompositeView sample code for javax.swing.text.CompositeView definition code for javax.swing.text.CompositeView
Parameters:
x - the X coordinate >= 0
y - the Y coordinate >= 0
innerAlloc - the allocated region; this is the area inside of the insets
Returns:
true if the point lies after the region else false

getViewAtPoint sample code for javax.swing.text.BoxView.getViewAtPoint(int, int, java.awt.Rectangle) definition code for javax.swing.text.BoxView.getViewAtPoint(int, int, java.awt.Rectangle)

protected View sample code for javax.swing.text.View definition code for javax.swing.text.View  getViewAtPoint(int x,
                              int y,
                              Rectangle sample code for java.awt.Rectangle definition code for java.awt.Rectangle  alloc)
Fetches the child view at the given coordinates.

Specified by:
getViewAtPoint sample code for javax.swing.text.CompositeView.getViewAtPoint(int, int, java.awt.Rectangle) definition code for javax.swing.text.CompositeView.getViewAtPoint(int, int, java.awt.Rectangle) in class CompositeView sample code for javax.swing.text.CompositeView definition code for javax.swing.text.CompositeView
Parameters:
x - the X coordinate >= 0
y - the Y coordinate >= 0
alloc - the parents inner allocation on entry, which should be changed to the childs allocation on exit
Returns:
the view

childAllocation sample code for javax.swing.text.BoxView.childAllocation(int, java.awt.Rectangle) definition code for javax.swing.text.BoxView.childAllocation(int, java.awt.Rectangle)

protected void childAllocation(int index,
                               Rectangle sample code for java.awt.Rectangle definition code for java.awt.Rectangle  alloc)
Allocates a region for a child view.

Specified by:
childAllocation sample code for javax.swing.text.CompositeView.childAllocation(int, java.awt.Rectangle) definition code for javax.swing.text.CompositeView.childAllocation(int, java.awt.Rectangle) in class CompositeView sample code for javax.swing.text.CompositeView definition code for javax.swing.text.CompositeView
Parameters:
index - the index of the child view to allocate, >= 0 && < getViewCount()
alloc - the allocated region

layout sample code for javax.swing.text.BoxView.layout(int, int) definition code for javax.swing.text.BoxView.layout(int, int)

protected void layout(int width,
                      int height)
Perform layout on the box

Parameters:
width - the width (inside of the insets) >= 0
height - the height (inside of the insets) >= 0

getWidth sample code for javax.swing.text.BoxView.getWidth() definition code for javax.swing.text.BoxView.getWidth()

public int getWidth()
Returns the current width of the box. This is the width that it was last allocated.

Returns:
the current width of the box

getHeight sample code for javax.swing.text.BoxView.getHeight() definition code for javax.swing.text.BoxView.getHeight()

public int getHeight()
Returns the current height of the box. This is the height that it was last allocated.

Returns:
the current height of the box

layoutMajorAxis sample code for javax.swing.text.BoxView.layoutMajorAxis(int, int, int[], int[]) definition code for javax.swing.text.BoxView.layoutMajorAxis(int, int, int[], int[])

protected void layoutMajorAxis(int targetSpan,
                               int axis,
                               int[] offsets,
                               int[] spans)
Performs layout for the major axis of the box (i.e. the axis that it represents). The results of the layout should be placed in the given arrays which represent the allocations to the children along the major axis.

Parameters:
targetSpan - the total span given to the view, which would be used to layout the children
axis - the axis being layed out
offsets - the offsets from the origin of the view for each of the child views; this is a return value and is filled in by the implementation of this method
spans - the span of each child view; this is a return value and is filled in by the implementation of this method

layoutMinorAxis sample code for javax.swing.text.BoxView.layoutMinorAxis(int, int, int[], int[]) definition code for javax.swing.text.BoxView.layoutMinorAxis(int, int, int[], int[])

protected void layoutMinorAxis(int targetSpan,
                               int axis,
                               int[] offsets,
                               int[] spans)
Performs layout for the minor axis of the box (i.e. the axis orthoginal to the axis that it represents). The results of the layout should be placed in the given arrays which represent the allocations to the children along the minor axis.

Parameters:
targetSpan - the total span given to the view, which would be used to layout the children
axis - the axis being layed out
offsets - the offsets from the origin of the view for each of the child views; this is a return value and is filled in by the implementation of this method
spans - the span of each child view; this is a return value and is filled in by the implementation of this method

calculateMajorAxisRequirements sample code for javax.swing.text.BoxView.calculateMajorAxisRequirements(int, javax.swing.SizeRequirements) definition code for javax.swing.text.BoxView.calculateMajorAxisRequirements(int, javax.swing.SizeRequirements)

protected SizeRequirements sample code for javax.swing.SizeRequirements definition code for javax.swing.SizeRequirements  calculateMajorAxisRequirements(int axis,
                                                          SizeRequirements sample code for javax.swing.SizeRequirements definition code for javax.swing.SizeRequirements  r)
Calculates the size requirements for the major axis axis.

Parameters:
axis - the axis being studied
r - the SizeRequirements object; if null one will be created
Returns:
the newly initialized SizeRequirements object
See Also:
SizeRequirements sample code for javax.swing.SizeRequirements definition code for javax.swing.SizeRequirements

calculateMinorAxisRequirements sample code for javax.swing.text.BoxView.calculateMinorAxisRequirements(int, javax.swing.SizeRequirements) definition code for javax.swing.text.BoxView.calculateMinorAxisRequirements(int, javax.swing.SizeRequirements)

protected SizeRequirements sample code for javax.swing.SizeRequirements definition code for javax.swing.SizeRequirements  calculateMinorAxisRequirements(int axis,
                                                          SizeRequirements sample code for javax.swing.SizeRequirements definition code for javax.swing.SizeRequirements  r)
Calculates the size requirements for the minor axis axis.

Parameters:
axis - the axis being studied
r - the SizeRequirements object; if null one will be created
Returns:
the newly initialized SizeRequirements object
See Also:
SizeRequirements sample code for javax.swing.SizeRequirements definition code for javax.swing.SizeRequirements

baselineLayout sample code for javax.swing.text.BoxView.baselineLayout(int, int, int[], int[]) definition code for javax.swing.text.BoxView.baselineLayout(int, int, int[], int[])

protected void baselineLayout(int targetSpan,
                              int axis,
                              int[] offsets,
                              int[] spans)
Computes the location and extent of each child view in this BoxView given the targetSpan, which is the width (or height) of the region we have to work with.

Parameters:
targetSpan - the total span given to the view, which would be used to layout the children
axis - the axis being studied, either View.X_AXIS or View.Y_AXIS
offsets - an empty array filled by this method with values specifying the location of each child view
spans - an empty array filled by this method with values specifying the extent of each child view

baselineRequirements sample code for javax.swing.text.BoxView.baselineRequirements(int, javax.swing.SizeRequirements) definition code for javax.swing.text.BoxView.baselineRequirements(int, javax.swing.SizeRequirements)

protected SizeRequirements sample code for javax.swing.SizeRequirements definition code for javax.swing.SizeRequirements  baselineRequirements(int axis,
                                                SizeRequirements sample code for javax.swing.SizeRequirements definition code for javax.swing.SizeRequirements  r)
Calculates the size requirements for this BoxView by examining the size of each child view.

Parameters:
axis - the axis being studied
r - the SizeRequirements object; if null one will be created
Returns:
the newly initialized SizeRequirements object

getOffset sample code for javax.swing.text.BoxView.getOffset(int, int) definition code for javax.swing.text.BoxView.getOffset(int, int)

protected int getOffset(int axis,
                        int childIndex)
Fetches the offset of a particular child's current layout.

Parameters:
axis - the axis being studied
childIndex - the index of the requested child
Returns:
the offset (location) for the specified child

getSpan sample code for javax.swing.text.BoxView.getSpan(int, int) definition code for javax.swing.text.BoxView.getSpan(int, int)

protected int getSpan(int axis,
                      int childIndex)
Fetches the span of a particular childs current layout.

Parameters:
axis - the axis being studied
childIndex - the index of the requested child
Returns:
the span (width or height) of the specified child

flipEastAndWestAtEnds sample code for javax.swing.text.BoxView.flipEastAndWestAtEnds(int, javax.swing.text.Position.Bias) definition code for javax.swing.text.BoxView.flipEastAndWestAtEnds(int, javax.swing.text.Position.Bias)

protected boolean flipEastAndWestAtEnds(int position,
                                        Position.Bias sample code for javax.swing.text.Position.Bias definition code for javax.swing.text.Position.Bias  bias)
Determines in which direction the next view lays. Consider the View at index n. Typically the Views are layed out from left to right, so that the View to the EAST will be at index n + 1, and the View to the WEST will be at index n - 1. In certain situations, such as with bidirectional text, it is possible that the View to EAST is not at index n + 1, but rather at index n - 1, or that the View to the WEST is not at index n - 1, but index n + 1. In this case this method would return true, indicating the Views are layed out in descending order. Otherwise the method would return false indicating the Views are layed out in ascending order.

If the receiver is laying its Views along the Y_AXIS, this will will return the value from invoking the same method on the View responsible for rendering position and bias. Otherwise this will return false.

Overrides:
flipEastAndWestAtEnds sample code for javax.swing.text.CompositeView.flipEastAndWestAtEnds(int, javax.swing.text.Position.Bias) definition code for javax.swing.text.CompositeView.flipEastAndWestAtEnds(int, javax.swing.text.Position.Bias) in class CompositeView sample code for javax.swing.text.CompositeView definition code for javax.swing.text.CompositeView
Parameters:
position - position into the model
bias - either Position.Bias.Forward or Position.Bias.Backward
Returns:
true if the Views surrounding the View responding for rendering position and bias are layed out in descending order; otherwise false