javax.swing.text
Class FlowView
- SwingConstants
A
View
that can flows it's children into it's layout space.
The
FlowView
manages a set of logical views (that are
the children of the
layoutPool
field). These are translated
at layout time into a set of physical views. These are the views that
are managed as the real child views. Each of these child views represents
a row and are laid out within a box using the superclasses behaviour.
The concrete implementation of the rows must be provided by subclasses.
static class | FlowView.FlowStrategy - A strategy for translating the logical views of a
FlowView
into the real views.
|
protected View | layoutPool - Represents the logical child elements of this view, encapsulated within
one parent view (an instance of a package private
LogicalView
class).
|
protected int | layoutSpan - The span of the
FlowView that should be flowed.
|
protected FlowView.FlowStrategy | strategy - The
FlowStrategy to use for translating between the
logical and physical view.
|
BOTTOM , CENTER , EAST , HORIZONTAL , LEADING , LEFT , NEXT , NORTH , NORTH_EAST , NORTH_WEST , PREVIOUS , RIGHT , SOUTH , SOUTH_EAST , SOUTH_WEST , TOP , TRAILING , VERTICAL , WEST |
FlowView(Element element, int axis) - Creates a new
FlowView for the given
Element and axis .
|
baselineLayout , baselineRequirements , calculateMajorAxisRequirements , calculateMinorAxisRequirements , childAllocation , flipEastAndWestAtEnds , forwardUpdate , getAlignment , getAxis , getChildAllocation , getHeight , getMaximumSpan , getMinimumSpan , getOffset , getPreferredSpan , getResizeWeight , getSpan , getViewAtPoint , getWidth , isAfter , isAllocationValid , isBefore , isLayoutValid , layout , layoutChanged , layoutMajorAxis , layoutMinorAxis , modelToView , paint , paintChild , preferenceChanged , replace , setAxis , setSize , viewToModel |
childAllocation , flipEastAndWestAtEnds , getBottomInset , getChildAllocation , getInsideAllocation , getLeftInset , getNextEastWestVisualPositionFrom , getNextNorthSouthVisualPositionFrom , getNextVisualPositionFrom , getRightInset , getTopInset , getView , getViewAtPoint , getViewAtPosition , getViewCount , getViewIndex , getViewIndexAtPosition , isAfter , isBefore , loadChildren , modelToView , modelToView , replace , setInsets , setParagraphInsets , setParent , viewToModel |
append , breakView , changedUpdate , createFragment , dump , forwardUpdate , forwardUpdateToView , getAlignment , getAttributes , getBreakWeight , getChildAllocation , getContainer , getDocument , getElement , getEndOffset , getGraphics , getMaximumSpan , getMinimumSpan , getNextVisualPositionFrom , getParent , getPreferredSpan , getResizeWeight , getStartOffset , getToolTipText , getView , getViewCount , getViewFactory , getViewIndex , getViewIndex , insert , insertUpdate , isVisible , modelToView , modelToView , modelToView , paint , preferenceChanged , remove , removeAll , removeUpdate , replace , setParent , setSize , updateChildren , updateLayout , viewToModel , viewToModel |
clone , equals , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
layoutPool
protected View layoutPool
Represents the logical child elements of this view, encapsulated within
one parent view (an instance of a package private
LogicalView
class). These will be translated to a set of real views that are then
displayed on screen. This translation is performed by the inner class
FlowView.FlowStrategy
.
layoutSpan
protected int layoutSpan
The span of the FlowView
that should be flowed.
FlowView
public FlowView(Element element,
int axis)
Creates a new FlowView
for the given
Element
and axis
.
element
- the element that is rendered by this FlowViewaxis
- the axis along which the view is tiled, either
View.X_AXIS
or View.Y_AXIS
, the flow
axis is orthogonal to this one
calculateMinorAxisRequirements
protected SizeRequirements calculateMinorAxisRequirements(int axis,
SizeRequirements r)
Calculates the size requirements of this BoxView
along
its minor axis, that is the axis opposite to the axis specified in the
constructor.
This is overridden and forwards the request to the logical view.
- calculateMinorAxisRequirements in interface BoxView
axis
- the axis that is examinedr
- the SizeRequirements
object to hold the result,
if null
, a new one is created
- the size requirements for this
BoxView
along
the specified axis
createRow
protected abstract View createRow()
Creates a new view that represents a row within a flow.
getFlowAxis
public int getFlowAxis()
Returns the axis along which the view should be flowed. This is
orthogonal to the axis along which the boxes are tiled.
- the axis along which the view should be flowed
getFlowSpan
public int getFlowSpan(int index)
Returns the span of the flow for the specified child view. A flow
layout can be shaped by providing different span values for different
child indices. The default implementation returns the entire available
span inside the view.
index
- the index of the child for which to return the span
- the span of the flow for the specified child view
getFlowStart
public int getFlowStart(int index)
Returns the location along the flow axis where the flow span starts
given a child view index. The flow can be shaped by providing
different values here.
index
- the index of the child for which to return the flow location
- the location along the flow axis where the flow span starts
getViewIndexAtPosition
protected int getViewIndexAtPosition(int pos)
Returns the index of the child View
for the given model
position.
This is implemented to iterate over the children of this
view (the rows) and return the index of the first view that contains
the given position.
- getViewIndexAtPosition in interface CompositeView
pos
- the model position for whicht the child View
is
queried
- the index of the child
View
for the given model
position
layout
protected void layout(int width,
int height)
Performs the layout of this view. If the span along the flow axis changed,
this first calls
FlowView.FlowStrategy.layout(FlowView)
in order to rebuild the
rows of this view. Then the superclass's behaviour is called to arrange
the rows within the box.
- layout in interface BoxView
width
- the width of the viewheight
- the height of the view
loadChildren
protected void loadChildren(ViewFactory vf)
Loads the children of this view. The
FlowView
does not
directly load its children. Instead it creates a logical view
(
layoutPool
) which is filled by the logical child views.
The real children are created at layout time and each represent one
row.
This method is called by
View.setParent(View)
in order to initialize
the view.
- loadChildren in interface CompositeView
vf
- the view factory to use for creating the child views
FlowView.java -- A composite View
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version.