breakView
method is called to try and carve the view into pieces
that fit.
View
| Modifier and Type | Class and Description |
|---|---|
| pack-priv class | ParagraphView.
Internally created view that has the purpose of holding the views that represent the children of the paragraph that have been arranged in rows. |
| Modifier and Type | Field and Description |
|---|---|
| protected int | firstLineIndent
Indentation for the first line, from the left inset. |
| pack-priv static Class | i18nStrategy
Used to create an i18n-based layout strategy |
| private int | |
| private float | |
| private int | tabBase
Used by the TabExpander functionality to determine where to base the tab calculations. |
| pack-priv static char[] | tabChars
Used for searching for a tab. |
| pack-priv static char[] | tabDecimalChars
Used for searching for a tab or decimal character. |
| Access | Constructor and Description |
|---|---|
| public | ParagraphView(Element
the element that this view is responsible for elem)Constructs a |
| Modifier and Type | Method and Description |
|---|---|
| public View | Returns: the fragment of the view that represents the given span, if the view can be broken; if the view doesn't support breaking behavior, the view itself is returnedmay be either axis, float View.X_AXIS
or View.Y_AXISspecifies where a potential break is desired
along the given axis >= 0 len, Shape the current allocation of the view a)Breaks this view on the given axis at the given length. |
| protected SizeRequirements | Returns: the new or adjustedSizeRequirements objectthe minor axis axis, SizeRequirements the input r)SizeRequirements objectOverrides javax. Calculate the needs for the paragraph along the minor axis. |
| public void | changedUpdate(DocumentEvent
the change information from the
associated document changes, Shape the current allocation of the view a, ViewFactory the factory to use to rebuild if the view has children f)Overrides javax. Gives notification from the document that attributes were changed in a location that this view is responsible for. |
| protected View | Returns: the newViewImplements abstract javax. Create a |
| private float | findEdgeSpan(View v, int axis, int fp, int p0, int p1)
Binary search for the longest non-breakable fragment at the view edge. |
| protected int | Returns: the document offset, or -1 if no characters foundthe string of characters string, int where to start in the model >= 0 start)Finds the next character in the document with a character in
|
| protected boolean | Returns: true if the text is laid out right to left at position, otherwise false.position into the model position, Position.either biasPosition.Bias.Forward or
Position.Bias.BackwardOverrides javax. Determines in which direction the next view lays. |
| public float | Returns: the desired alignment. This should be a value between 0.0 and 1.0 inclusive, 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.may be either axis)View.X_AXIS or
View.Y_AXISOverrides javax. Determines the desired alignment for this view along an axis. |
| public int | Returns: a value indicating the attractiveness of breaking here; eitherGoodBreakWeight or BadBreakWeightmay be either axis, float View.X_AXIS
or View.Y_AXISspecifies where a potential break is desired >= 0 len)Gets the break weight for a given location. |
| protected int | Returns: the closest model position toxposition into the model pos, Position.the bias b,the allocated region to render into a, int one of the following values:
direction, Position.
an array containing the bias that were checked
in this method biasRet,the index of the view rowIndex, int the x coordinate of interest x)Returns the closest model position to |
| public int | Returns: the constraining span for the given view atindexthe index of the view being queried index)Overrides javax. Fetches the constraining span to flow against for the given child index. |
| public int | Returns: the location for the given view atindexthe index of the view being queried index)Overrides javax. Fetches the location along the flow axis that the flow span will start at. |
| protected View | Returns: the view atindexthe index)index of the desired viewReturns the view at a given |
| protected int | Returns: the number of views that thisParagraphView
is responsible forReturns the number of views that this view is responsible for. |
| protected int | Returns: the location in the model that represents the next location visual positionposition into the model pos, Position.either b,Position.Bias.Forward or
Position.Bias.Backwardthe allocated region to render into a, int either direction, Position.SwingConstants.NORTH
or SwingConstants.SOUTHan array containing the bias that were checked
in this method biasRetOverrides javax. Returns the next visual position for the cursor, in either the east or west direction. |
| protected float | Returns: the size >= 0the starting document offset >= 0 startOffset, int the ending document offset >= startOffset endOffset)Returns the size used by the views between
|
| protected float | |
| protected TabSet | |
| public float | Returns: the trailing end of the tab expansion >= 0the X reference position x, int the position within the text stream
that the tab occurred at >= 0 tabOffset)Implements javax. Returns the next tab stop position given a reference position. |
| public void | paint(Graphics
the rendering surface to use g, Shape the allocated region to render into a)Overrides javax. Renders using the given rendering surface and area on that surface. |
| protected void | |
| protected void | setJustification(int
one of the following values:
j)
Sets the type of justification. |
| protected void | |
| protected void |
| firstLineIndent | back to summary |
|---|---|
| protected int firstLineIndent Indentation for the first line, from the left inset. | |
| i18nStrategy | back to summary |
|---|---|
| pack-priv static Class<?> i18nStrategy Used to create an i18n-based layout strategy | |
| justification | back to summary |
|---|---|
| private int justification | |
| lineSpacing | back to summary |
|---|---|
| private float lineSpacing | |
| tabBase | back to summary |
|---|---|
| private int tabBase Used by the TabExpander functionality to determine where to base the tab calculations. This is basically the location of the left side of the paragraph. | |
| tabChars | back to summary |
|---|---|
| pack-priv static char[] tabChars Used for searching for a tab. | |
| tabDecimalChars | back to summary |
|---|---|
| pack-priv static char[] tabDecimalChars Used for searching for a tab or decimal character. | |
| ParagraphView | back to summary |
|---|---|
| public ParagraphView(Element elem) Constructs a
| |
| breakView | back to summary |
|---|---|
| public View breakView(int axis, float len, Shape a) Breaks this view on the given axis at the given length.
| |
| calculateMinorAxisRequirements | back to summary |
|---|---|
| protected SizeRequirements calculateMinorAxisRequirements(int axis, SizeRequirements r) Overrides javax. Calculate the needs for the paragraph along the minor axis. This uses size requirements of the superclass, modified to take into account the non-breakable areas at the adjacent views edges. The minimal size requirements for such views should be no less than the sum of all adjacent fragments. If the
| |
| changedUpdate | back to summary |
|---|---|
| public void changedUpdate(DocumentEvent changes, Shape a, ViewFactory f) Overrides javax. Gives notification from the document that attributes were changed in a location that this view is responsible for.
| |
| createRow | back to summary |
|---|---|
| protected View createRow() Implements abstract javax. Create a
| |
| findEdgeSpan | back to summary |
|---|---|
| private float findEdgeSpan(View v, int axis, int fp, int p0, int p1) Binary search for the longest non-breakable fragment at the view edge. | |
| findOffsetToCharactersInString | back to summary |
|---|---|
| protected int findOffsetToCharactersInString(char[] string, int start) Finds the next character in the document with a character in
| |
| flipEastAndWestAtEnds | back to summary |
|---|---|
| protected boolean flipEastAndWestAtEnds(int position, Position. Overrides javax. Determines in which direction the next view lays.
Consider the This will return true if the text is laid out right to left at position, otherwise false. | |
| getAlignment | back to summary |
|---|---|
| public float getAlignment(int axis) Overrides javax. Determines the desired alignment for this view along an axis. This is implemented to give the alignment to the center of the first row along the y axis, and the default along the x axis.
| |
| getBreakWeight | back to summary |
|---|---|
| public int getBreakWeight(int axis, float len) Gets the break weight for a given location.
| |
| getClosestPositionTo | back to summary |
|---|---|
| protected int getClosestPositionTo(int pos, Position. Returns the closest model position to
| |
| getFlowSpan | back to summary |
|---|---|
| public int getFlowSpan(int index) Overrides javax. Fetches the constraining span to flow against for the given child index.
| |
| getFlowStart | back to summary |
|---|---|
| public int getFlowStart(int index) Overrides javax. Fetches the location along the flow axis that the flow span will start at.
| |
| getLayoutView | back to summary |
|---|---|
| protected View getLayoutView(int index) Returns the view at a given
| |
| getLayoutViewCount | back to summary |
|---|---|
| protected int getLayoutViewCount() Returns the number of views that this view is
responsible for.
The child views of the paragraph are rows which
have been used to arrange pieces of the
| |
| getNextNorthSouthVisualPositionFrom | back to summary |
|---|---|
| protected int getNextNorthSouthVisualPositionFrom(int pos, Position. Overrides javax. Returns the next visual position for the cursor, in
either the east or west direction.
Overridden from
| |
| getPartialSize | back to summary |
|---|---|
| protected float getPartialSize(int startOffset, int endOffset) Returns the size used by the views between
| |
| getTabBase | back to summary |
|---|---|
| protected float getTabBase() Returns where the tabs are calculated from.
| |
| getTabSet | back to summary |
|---|---|
| protected TabSet getTabSet() Gets the
| |
| nextTabStop | back to summary |
|---|---|
| public float nextTabStop(float x, int tabOffset) Implements javax. Returns the next tab stop position given a reference position.
This view implements the tab coordinate system, and calls
This is implemented to try and locate a | |
| paint | back to summary |
|---|---|
| public void paint(Graphics g, Shape a) Overrides javax. Renders using the given rendering surface and area on that surface. This is implemented to delegate to the superclass after stashing the base coordinate for tab calculations.
| |
| setFirstLineIndent | back to summary |
|---|---|
| protected void setFirstLineIndent(float fi) Sets the indent on the first line.
| |
| setJustification | back to summary |
|---|---|
| protected void setJustification(int j) Sets the type of justification.
| |
| setLineSpacing | back to summary |
|---|---|
| protected void setLineSpacing(float ls) Sets the line spacing.
| |
| setPropertiesFromAttributes | back to summary |
|---|---|
| protected void setPropertiesFromAttributes() Set the cached properties from the attributes. | |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv static final int | |
| pack-priv int[] | |
| pack-priv static final int | |
| pack-priv static final int | |
| pack-priv static final int |
| Modifier and Type | Method and Description |
|---|---|
| protected SizeRequirements | calculateMajorAxisRequirements(int axis, SizeRequirements r)
Overrides javax. Calculates the size requirements for the major axis
|
| protected SizeRequirements | calculateMinorAxisRequirements(int axis, SizeRequirements r)
Overrides javax. Calculates the size requirements for the minor axis
|
| public float | getAlignment(int axis)
Overrides javax. Determines the desired alignment for this view along an axis. |
| public AttributeSet | getAttributes()
Overrides javax. Fetches the attributes to use when rendering. |
| protected short | |
| public int | getEndOffset()
Overrides javax. Fetches the portion of the model for which this view is responsible. |
| protected short | Returns: the insetOverrides javax. Gets the left inset. |
| public float | getMaximumSpan(int axis)
Overrides javax. Determines the maximum span for this view along an axis. |
| public int | getStartOffset()
Overrides javax. Range represented by a row in the paragraph is only a subset of the total range of the paragraph element. |
| protected int | Returns: index of the view representing the given position, or -1 if no view represents that positionthe position >= 0 pos)Overrides javax. Fetches the child view index representing the given position in the model. |
| private boolean | |
| private boolean | |
| private boolean | Returns: true if this Row should be justified.Whether we need to justify this |
| private boolean | |
| protected void | layoutMajorAxis(int targetSpan, int axis, int[] offsets, int[] spans)
Overrides javax. Performs layout for the major axis of the box (i.e. the axis that it represents). |
| protected void | Returns: the offset and span for each child view in the offsets and spans parametersthe total span given to the view, which
would be used to layout the children. targetSpan, int the axis being laid out. axis, int[] 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. offsets, int[] the span of each child view. This is a return
value and is filled in by the implementation of this method. spans)Overrides javax. Perform layout for the minor axis of the box (i.e. the axis orthogonal to the axis that it represents). |
| protected void | loadChildren(ViewFactory f)
Overrides javax. This is reimplemented to do nothing since the paragraph fills in the row with its needed children. |
| public Shape | Returns: the bounding box of the given positionthe position to convert pos, Shape the allocated region to render into a, Position.Overrides javax. Provides a mapping from the document model coordinate space to the coordinate space of the view mapped to it. |
| END_JUSTIFIABLE | back to summary |
|---|---|
| pack-priv static final int END_JUSTIFIABLE | |
| justificationData | back to summary |
|---|---|
| pack-priv int[] justificationData | |
| SPACE_ADDON | back to summary |
|---|---|
| pack-priv static final int SPACE_ADDON | |
| SPACE_ADDON_LEFTOVER_END | back to summary |
|---|---|
| pack-priv static final int SPACE_ADDON_LEFTOVER_END | |
| START_JUSTIFIABLE | back to summary |
|---|---|
| pack-priv static final int START_JUSTIFIABLE | |
| Row | back to summary |
|---|---|
| pack-priv Row(Element elem) | |
| calculateMajorAxisRequirements | back to summary |
|---|---|
| protected SizeRequirements calculateMajorAxisRequirements(int axis, SizeRequirements r) Overrides javax. Doc from javax. Calculates the size requirements for the major axis
| |
| calculateMinorAxisRequirements | back to summary |
|---|---|
| protected SizeRequirements calculateMinorAxisRequirements(int axis, SizeRequirements r) Overrides javax. Doc from javax. Calculates the size requirements for the minor axis
| |
| getAlignment | back to summary |
|---|---|
| public float getAlignment(int axis) Overrides javax. Doc from javax. 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 orthogonal to the axis that is being tiled. The axis being tiled will request to be centered (i.e. 0.5f). | |
| getAttributes | back to summary |
|---|---|
| public AttributeSet getAttributes() Overrides javax. Fetches the attributes to use when rendering. This view isn't directly responsible for an element so it returns the outer classes attributes. | |
| getBottomInset | back to summary |
|---|---|
| protected short getBottomInset() Overrides javax. Doc from javax. Gets the bottom inset. | |
| getEndOffset | back to summary |
|---|---|
| public int getEndOffset() Overrides javax. Doc from javax. Fetches the portion of the model for which this view is responsible. | |
| getLeftInset | back to summary |
|---|---|
| protected short getLeftInset() Overrides javax. Gets the left inset.
| |
| getMaximumSpan | back to summary |
|---|---|
| public float getMaximumSpan(int axis) Overrides javax. Doc from javax. Determines the maximum span for this view along an axis.
| |
| getStartOffset | back to summary |
|---|---|
| public int getStartOffset() Overrides javax. Range represented by a row in the paragraph is only a subset of the total range of the paragraph element. | |
| getViewIndexAtPosition | back to summary |
|---|---|
| protected int getViewIndexAtPosition(int pos) Overrides javax. Fetches the child view index representing the given position in the model.
| |
| isBrokenRow | back to summary |
|---|---|
| private boolean isBrokenRow() | |
| isJustifiableDocument | back to summary |
|---|---|
| private boolean isJustifiableDocument() | |
| isJustifyEnabled | back to summary |
|---|---|
| private boolean isJustifyEnabled() Whether we need to justify this
| |
| isLastRow | back to summary |
|---|---|
| private boolean isLastRow() | |
| layoutMajorAxis | back to summary |
|---|---|
| protected void layoutMajorAxis(int targetSpan, int axis, int[] offsets, int[] spans) Overrides javax. Doc from javax. Performs layout for the major axis of the box (i.e. the axis that it represents). The results of the layout (the offset and span for each children) are placed in the given arrays which represent the allocations to the children along the major axis.
| |
| layoutMinorAxis | back to summary |
|---|---|
| protected void layoutMinorAxis(int targetSpan, int axis, int[] offsets, int[] spans) Overrides javax. Perform layout for the minor axis of the box (i.e. the axis orthogonal 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.
| |
| loadChildren | back to summary |
|---|---|
| protected void loadChildren(ViewFactory f) Overrides javax. This is reimplemented to do nothing since the paragraph fills in the row with its needed children. | |
| modelToView | back to summary |
|---|---|
| public Shape modelToView(int pos, Shape a, Position. Overrides javax. 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.
| |