javax.swing.text
public static class FlowView.FlowStrategy extends Object
FlowView
into the real views.Constructor and Description |
---|
FlowView.FlowStrategy()
Creates a new instance of
FlowStragegy . |
Modifier and Type | Method and Description |
---|---|
protected void |
adjustRow(FlowView fv,
int rowIndex,
int desiredSpan,
int x)
Tries to adjust the specified row to fit within the desired span.
|
void |
changedUpdate(FlowView fv,
DocumentEvent e,
Rectangle alloc)
Receives notification from a
FlowView that some attributes
have changed in the document at a location that the
FlowView is responsible for. |
protected View |
createView(FlowView fv,
int startOffset,
int spanLeft,
int rowIndex)
Creates physical views that form the rows of the flow view.
|
protected View |
getLogicalView(FlowView fv)
Returns the logical view of the managed
FlowView . |
void |
insertUpdate(FlowView fv,
DocumentEvent e,
Rectangle alloc)
Receives notification from a
FlowView that some content
has been inserted into the document at a location that the
FlowView is responsible for. |
void |
layout(FlowView fv)
Performs the layout for the whole view.
|
protected int |
layoutRow(FlowView fv,
int rowIndex,
int pos)
Lays out one row of the flow view.
|
void |
removeUpdate(FlowView fv,
DocumentEvent e,
Rectangle alloc)
Receives notification from a
FlowView that some content
has been removed from the document at a location that the
FlowView is responsible for. |
public FlowView.FlowStrategy()
FlowStragegy
.public void insertUpdate(FlowView fv, DocumentEvent e, Rectangle alloc)
FlowView
that some content
has been inserted into the document at a location that the
FlowView
is responsible for.
The default implementation simply calls layout(javax.swing.text.FlowView)
.fv
- the flow view that sends the notificatione
- the document event describing the changealloc
- the current allocation of the flow viewpublic void removeUpdate(FlowView fv, DocumentEvent e, Rectangle alloc)
FlowView
that some content
has been removed from the document at a location that the
FlowView
is responsible for.
The default implementation simply calls layout(javax.swing.text.FlowView)
.fv
- the flow view that sends the notificatione
- the document event describing the changealloc
- the current allocation of the flow viewpublic void changedUpdate(FlowView fv, DocumentEvent e, Rectangle alloc)
FlowView
that some attributes
have changed in the document at a location that the
FlowView
is responsible for.
The default implementation simply calls layout(javax.swing.text.FlowView)
.fv
- the flow view that sends the notificatione
- the document event describing the changealloc
- the current allocation of the flow viewprotected View getLogicalView(FlowView fv)
FlowView
.fv
- the flow view for which to return the logical viewFlowView
public void layout(FlowView fv)
FlowView.layout(int, int)
to update the layout of
the view.fv
- the flow view for which we perform the layoutprotected int layoutRow(FlowView fv, int rowIndex, int pos)
layout(javax.swing.text.FlowView)
to
fill one row with child views until the available span is exhausted. The
default implementation fills the row by calling
createView(FlowView, int, int, int)
until the available space is
exhausted, a forced break is encountered or there are no more views in
the logical view. If the available space is exhausted,
adjustRow(FlowView, int, int, int)
is called to fit the row into
the available span.fv
- the flow view for which we perform the layoutrowIndex
- the index of the rowpos
- the model position for the beginning of the rowprotected View createView(FlowView fv, int startOffset, int spanLeft, int rowIndex)
null
(if it does
not fit in the available span and also cannot be broken down).
The default implementation fetches the logical view at the specified
startOffset
. If that view has a different startOffset than
specified in the argument, a fragment is created using
View.createFragment(int, int)
that has the correct startOffset
and the logical view's endOffset.fv
- the flow viewstartOffset
- the start offset for the view to be createdspanLeft
- the available spanrowIndex
- the index of the rownull
if there
is no view or view fragment that fits in the available spanprotected void adjustRow(FlowView fv, int rowIndex, int desiredSpan, int x)
View.BadBreakWeight
, this view is broken using the
View.breakView(int, int, float, float)
method and this view and
all views after the now broken view are replaced by the broken view.fv
- the flow viewrowIndex
- the index of the row to be adjusteddesiredSpan
- the layout spanx
- the X location at which the row starts