- java.lang.Object
-
- javax.swing.text.FlowView.FlowStrategy
-
- Enclosing class:
- FlowView
public static class FlowView.FlowStrategy extends Object
Strategy for maintaining the physical form of the flow. The default implementation is completely stateless, and recalculates the entire flow if the layout is invalid on the given FlowView. Alternative strategies can be implemented by subclassing, and might perform incrementatal repair to the layout or alternative breaking behavior.- Since:
- 1.3
-
-
Constructor Summary
Constructors Constructor and Description FlowView.FlowStrategy()
-
Method Summary
Methods Modifier and Type Method and Description protected void
adjustRow(FlowView fv, int rowIndex, int desiredSpan, int x)
Adjusts the given row if possible to fit within the layout span.void
changedUpdate(FlowView fv, DocumentEvent e, Rectangle alloc)
Gives notification from the document that attributes were changed in a location that this view is responsible for.protected View
createView(FlowView fv, int startOffset, int spanLeft, int rowIndex)
Creates a view that can be used to represent the current piece of the flow.protected View
getLogicalView(FlowView fv)
This method gives flow strategies access to the logical view of the FlowView.void
insertUpdate(FlowView fv, DocumentEvent e, Rectangle alloc)
Gives notification that something was inserted into the document in a location that the given flow view is responsible for.void
layout(FlowView fv)
Update the flow on the given FlowView.protected int
layoutRow(FlowView fv, int rowIndex, int pos)
Creates a row of views that will fit within the layout span of the row.void
removeUpdate(FlowView fv, DocumentEvent e, Rectangle alloc)
Gives notification that something was removed from the document in a location that the given flow view is responsible for.
-
-
-
Method Detail
-
insertUpdate
public void insertUpdate(FlowView fv, DocumentEvent e, Rectangle alloc)
Gives notification that something was inserted into the document in a location that the given flow view is responsible for. The strategy should update the appropriate changed region (which depends upon the strategy used for repair).- Parameters:
e
- the change information from the associated documentalloc
- the current allocation of the view inside of the insets. This value will be null if the view has not yet been displayed.- See Also:
View.insertUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory)
-
removeUpdate
public void removeUpdate(FlowView fv, DocumentEvent e, Rectangle alloc)
Gives notification that something was removed from the document in a location that the given flow view is responsible for.- Parameters:
e
- the change information from the associated documentalloc
- the current allocation of the view inside of the insets.- See Also:
View.removeUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory)
-
changedUpdate
public void changedUpdate(FlowView fv, DocumentEvent e, Rectangle alloc)
Gives notification from the document that attributes were changed in a location that this view is responsible for.- Parameters:
fv
- theFlowView
containing the changese
- theDocumentEvent
describing the changes done to the Documentalloc
- Bounds of the View- See Also:
View.changedUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory)
-
getLogicalView
protected View getLogicalView(FlowView fv)
This method gives flow strategies access to the logical view of the FlowView.
-
layout
public void layout(FlowView fv)
Update the flow on the given FlowView. By default, this causes all of the rows (child views) to be rebuilt to match the given constraints for each row. This is called by a FlowView.layout to update the child views in the flow.- Parameters:
fv
- the view to reflow
-
layoutRow
protected int layoutRow(FlowView fv, int rowIndex, int pos)
Creates a row of views that will fit within the layout span of the row. This is called by the layout method. This is implemented to fill the row by repeatedly calling the createView method until the available span has been exhausted, a forced break was encountered, or the createView method returned null. If the remaining span was exhaused, the adjustRow method will be called to perform adjustments to the row to try and make it fit into the given span.- Parameters:
rowIndex
- the index of the row to fill in with views. The row is assumed to be empty on entry.pos
- The current position in the children of this views element from which to start.- Returns:
- the position to start the next row
-
adjustRow
protected void adjustRow(FlowView fv, int rowIndex, int desiredSpan, int x)
Adjusts the given row if possible to fit within the layout span. By default this will try to find the highest break weight possible nearest the end of the row. If a forced break is encountered, the break will be positioned there.- Parameters:
rowIndex
- the row to adjust to the current layout span.desiredSpan
- the current layout span >= 0x
- the location r starts at.
-
createView
protected View createView(FlowView fv, int startOffset, int spanLeft, int rowIndex)
Creates a view that can be used to represent the current piece of the flow. This can be either an entire view from the logical view, or a fragment of the logical view.- Parameters:
fv
- the view holding the flowstartOffset
- the start location for the view being createdspanLeft
- the about of span left to fill in the rowrowIndex
- the row the view will be placed into
-
-
Nederlandse vertaling
U hebt gevraagd om deze site in het Nederlands te bezoeken. Voor nu wordt alleen de interface vertaald, maar nog niet alle inhoud.Als je me wilt helpen met vertalingen, is je bijdrage welkom. Het enige dat u hoeft te doen, is u op de site registreren en mij een bericht sturen waarin u wordt gevraagd om u toe te voegen aan de groep vertalers, zodat u de gewenste pagina's kunt vertalen. Een link onderaan elke vertaalde pagina geeft aan dat u de vertaler bent en heeft een link naar uw profiel.
Bij voorbaat dank.
Document heeft de 11/06/2005 gemaakt, de laatste keer de 04/03/2020 gewijzigd
Bron van het afgedrukte document:https://www.gaudry.be/nl/java-api-rf-javax/swing/text/FlowView.FlowStrategy.html
De infobrol is een persoonlijke site waarvan de inhoud uitsluitend mijn verantwoordelijkheid is. De tekst is beschikbaar onder CreativeCommons-licentie (BY-NC-SA). Meer info op de gebruiksvoorwaarden en de auteur.
Referenties
Deze verwijzingen en links verwijzen naar documenten die geraadpleegd zijn tijdens het schrijven van deze pagina, of die aanvullende informatie kunnen geven, maar de auteurs van deze bronnen kunnen niet verantwoordelijk worden gehouden voor de inhoud van deze pagina.
De auteur Deze site is als enige verantwoordelijk voor de manier waarop de verschillende concepten, en de vrijheden die met de referentiewerken worden genomen, hier worden gepresenteerd. Vergeet niet dat u meerdere broninformatie moet doorgeven om het risico op fouten te verkleinen.