javax.swing.text
Class ParagraphView.Row

java.lang.Object
  extended byjavax.swing.text.View
      extended byjavax.swing.text.CompositeView
          extended byjavax.swing.text.BoxView
              extended byjavax.swing.text.ParagraphView.Row
All Implemented Interfaces:
SwingConstants
Enclosing class:
ParagraphView

class ParagraphView.Row
extends BoxView

Internally created view that has the purpose of holding the views that represent the children of the paragraph that have been arranged in rows.


Field Summary
 
Fields inherited from class javax.swing.text.BoxView
majorAllocValid, majorAxis, majorOffsets, majorRequest, majorReqValid, majorSpan, majorSpans, minorAllocValid, minorOffsets, minorRequest, minorReqValid, minorSpan, minorSpans, tempRect
 
Fields inherited from class javax.swing.text.CompositeView
 
Fields inherited from class javax.swing.text.View
BadBreakWeight, ExcellentBreakWeight, ForcedBreakWeight, GoodBreakWeight, sharedBiasReturn, X_AXIS, Y_AXIS
 
Fields inherited from interface javax.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
 
Constructor Summary
(package private) ParagraphView.Row(Element elem)
           
 
Method Summary
protected  SizeRequirements calculateMinorAxisRequirements(int axis, SizeRequirements r)
          Calculates the size requirements for the minor axis axis.
 float getAlignment(int axis)
          Determines the desired alignment for this view along an axis.
 AttributeSet getAttributes()
          Fetches the attributes to use when rendering.
protected  short getBottomInset()
          Gets the bottom inset.
 int getEndOffset()
          Fetches the portion of the model for which this view is responsible.
protected  short getLeftInset()
          Gets the left inset.
 int getStartOffset()
          Range represented by a row in the paragraph is only a subset of the total range of the paragraph element.
protected  int getViewIndexAtPosition(int pos)
          Fetches the child view index representing the given position in the model.
protected  void layoutMinorAxis(int targetSpan, int axis, int[] offsets, int[] spans)
          Perform layout for the minor axis of the box (i.e. the axis orthoginal to the axis that it represents).
protected  void loadChildren(ViewFactory f)
          This is reimplemented to do nothing since the paragraph fills in the row with its needed children.
 Shape modelToView(int pos, Shape a, Position.Bias b)
          Provides a mapping from the document model coordinate space to the coordinate space of the view mapped to it.
 
Methods inherited from class javax.swing.text.BoxView
baselineLayout, baselineRequirements, calculateMajorAxisRequirements, checkRequests, childAllocation, flipEastAndWestAtEnds, forwardUpdate, getAxis, getChildAllocation, getHeight, getMaximumSpan, getMinimumSpan, getOffset, getPreferredSpan, getResizeWeight, getSpan, getSpanOnAxis, getViewAtPoint, getWidth, isAfter, isAllocationValid, isBefore, isLayoutValid, layout, layoutChanged, layoutMajorAxis, paint, paintChild, preferenceChanged, replace, setAxis, setSize, setSpanOnAxis, updateChildSizes, updateLayoutArray, viewToModel
 
Methods inherited from class javax.swing.text.CompositeView
getInsideAllocation, getNextEastWestVisualPositionFrom, getNextNorthSouthVisualPositionFrom, getNextVisualPositionFrom, getRightInset, getTopInset, getView, getViewAtPosition, getViewCount, getViewIndex, modelToView, setInsets, setParagraphInsets, setParent
 
Methods inherited from class javax.swing.text.View
append, breakView, changedUpdate, createFragment, forwardUpdateToView, getBreakWeight, getContainer, getDocument, getElement, getGraphics, getParent, getToolTipText, getViewFactory, getViewIndex, insert, insertUpdate, isVisible, modelToView, remove, removeAll, removeUpdate, updateChildren, updateLayout, viewToModel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ParagraphView.Row

ParagraphView.Row(Element elem)
Method Detail

loadChildren

protected void loadChildren(ViewFactory f)
This is reimplemented to do nothing since the paragraph fills in the row with its needed children.

Overrides:
loadChildren in class CompositeView
Parameters:
f - the view factory
See Also:
CompositeView.setParent(javax.swing.text.View)

getAttributes

public AttributeSet getAttributes()
Fetches the attributes to use when rendering. This view isn't directly responsible for an element so it returns the outer classes attributes.

Overrides:
getAttributes in class View

getAlignment

public float getAlignment(int axis)
Description copied from class: BoxView
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 in class BoxView
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

modelToView

public Shape modelToView(int pos,
                         Shape a,
                         Position.Bias b)
                  throws BadLocationException
Provides a mapping from the document model coordinate space to the coordinate space of the view mapped to it. This is implemented to let the superclass find the position along the major axis and the allocation of the row is used along the minor axis, so that even though the children are different heights they all get the same caret height.

Overrides:
modelToView in class BoxView
Parameters:
pos - the position to convert
a - the allocated region to render into
Returns:
the bounding box of the given position
Throws:
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)

getStartOffset

public int getStartOffset()
Range represented by a row in the paragraph is only a subset of the total range of the paragraph element.

Overrides:
getStartOffset in class View
Returns:
the starting offset into the model >= 0
See Also:
View#getRange

getEndOffset

public int getEndOffset()
Description copied from class: View
Fetches the portion of the model for which this view is responsible.

Overrides:
getEndOffset in class View
Returns:
the ending offset into the model >= 0
See Also:
View.getEndOffset()

layoutMinorAxis

protected void layoutMinorAxis(int targetSpan,
                               int axis,
                               int[] offsets,
                               int[] spans)
Perform 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.

This is implemented to do a baseline layout of the children by calling BoxView.baselineLayout.

Overrides:
layoutMinorAxis in class BoxView
Parameters:
targetSpan - the total span given to the view, which whould 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.
Returns:
the offset and span for each child view in the offsets and spans parameters

calculateMinorAxisRequirements

protected SizeRequirements calculateMinorAxisRequirements(int axis,
                                                          SizeRequirements r)
Description copied from class: BoxView
Calculates the size requirements for the minor axis axis.

Overrides:
calculateMinorAxisRequirements in class BoxView
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

getViewIndexAtPosition

protected int getViewIndexAtPosition(int pos)
Fetches the child view index representing the given position in the model.

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

getLeftInset

protected short getLeftInset()
Gets the left inset.

Overrides:
getLeftInset in class CompositeView
Returns:
the inset

getBottomInset

protected short getBottomInset()
Description copied from class: CompositeView
Gets the bottom inset.

Overrides:
getBottomInset in class CompositeView
Returns:
the inset >= 0