Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

javax.swing.text
Class FlowView.FlowStrategy  view FlowView.FlowStrategy download FlowView.FlowStrategy.java

java.lang.Object
  extended byjavax.swing.text.FlowView.FlowStrategy
Enclosing class:
FlowView

public static class FlowView.FlowStrategy
extends java.lang.Object

A strategy for translating the logical views of a FlowView into the real views.


Constructor Summary
FlowView.FlowStrategy()
          Creates a new instance of FlowStragegy.
 
Method Summary
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, javax.swing.event.DocumentEvent e, java.awt.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, javax.swing.event.DocumentEvent e, java.awt.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, javax.swing.event.DocumentEvent e, java.awt.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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FlowView.FlowStrategy

public FlowView.FlowStrategy()
Creates a new instance of FlowStragegy.

Method Detail

insertUpdate

public void insertUpdate(FlowView fv,
                         javax.swing.event.DocumentEvent e,
                         java.awt.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. The default implementation simply calls layout(javax.swing.text.FlowView) 55 .


removeUpdate

public void removeUpdate(FlowView fv,
                         javax.swing.event.DocumentEvent e,
                         java.awt.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. The default implementation simply calls layout(javax.swing.text.FlowView) 55 .


changedUpdate

public void changedUpdate(FlowView fv,
                          javax.swing.event.DocumentEvent e,
                          java.awt.Rectangle alloc)
Receives notification from a 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) 55 .


getLogicalView

protected View getLogicalView(FlowView fv)
Returns the logical view of the managed FlowView.


layout

public void layout(FlowView fv)
Performs the layout for the whole view. By default this rebuilds all the physical views from the logical views of the managed FlowView. This is called by FlowView.layout(int, int) 55 to update the layout of the view.


layoutRow

protected int layoutRow(FlowView fv,
                        int rowIndex,
                        int pos)
Lays out one row of the flow view. This is called by layout(javax.swing.text.FlowView) 55 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) 55 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) 55 is called to fit the row into the available span.


createView

protected View createView(FlowView fv,
                          int startOffset,
                          int spanLeft,
                          int rowIndex)
Creates physical views that form the rows of the flow view. This can be an entire view from the logical view (if it fits within the available span), a fragment of such a view (if it doesn't fit in the available span and can be broken down) or 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) 55 that has the correct startOffset and the logical view's endOffset.


adjustRow

protected void adjustRow(FlowView fv,
                         int rowIndex,
                         int desiredSpan,
                         int x)
Tries to adjust the specified row to fit within the desired span. The default implementation iterates through the children of the specified row to find the view that has the highest break weight and - if there is more than one view with such a break weight - which is nearest to the end of the row. If there is such a view that has a break weight > View.BadBreakWeight 55 , this view is broken using the View.breakView(int, int, float, float) 55 method and this view and all views after the now broken view are replaced by the broken view.