breakView
public View breakView(int axis,
int offset,
float pos,
float len)
changedUpdate
public void changedUpdate(DocumentEvent ev,
Shape shape,
ViewFactory vf)
Receive notification about a change update to the text model.
The default implementation of this method does the following:
ev
- the DocumentEvent that describes the changeshape
- the shape of the viewvf
- the ViewFactory for creating child views
dump
protected void dump()
Dumps the complete View hierarchy. This method can be used for debugging
purposes.
forwardUpdate
protected void forwardUpdate(DocumentEvent.ElementChange ec,
DocumentEvent ev,
Shape shape,
ViewFactory vf)
Forwards the DocumentEvent to child views that need to get notified
of the change to the model. This calles
forwardUpdateToView(View,DocumentEvent,Shape,ViewFactory)
for each View that must be forwarded to.
If
ec
is not
null
(this means there have been
structural changes to the element that this view is responsible for) this
method should recognize this and don't notify newly added child views.
ec
- the ElementChange describing the element changes (may be
null
if there were no changes)ev
- the DocumentEvent describing the changes to the modelshape
- the current allocation of the viewvf
- the ViewFactory used to create new Views
forwardUpdateToView
protected void forwardUpdateToView(View view,
DocumentEvent ev,
Shape shape,
ViewFactory vf)
view
- the View to forward the event toev
- the DocumentEvent to forwardshape
- the current allocation of the Viewvf
- the ViewFactory used to create new Views
getAlignment
public float getAlignment(int axis)
Returns the alignment of this view along the baseline of the parent view.
An alignment of 0.0
will align this view with the left edge
along the baseline, an alignment of 0.5
will align it
centered to the baseline, an alignment of 1.0
will align
the right edge along the baseline.
The default implementation returns 0.5 unconditionally.
- the alignment of this view along the parents baseline for the
specified axis
getBreakWeight
public int getBreakWeight(int axis,
float pos,
float len)
getMaximumSpan
public float getMaximumSpan(int axis)
- the maximum span along the specified axis
getMinimumSpan
public float getMinimumSpan(int axis)
- the minimum span along the specified axis
getNextVisualPositionFrom
public int getNextVisualPositionFrom(int pos,
Position.Bias b,
Shape a,
int d,
Position.Bias[] biasRet)
throws BadLocationException
Returns the document position that is (visually) nearest to the given
document position pos
in the given direction d
.
- the document position that is (visually) nearest to the given
document position
pos
in the given direction
d
getPreferredSpan
public abstract float getPreferredSpan(int axis)
Returns the preferred span along the specified axis. Normally the view is
rendered with the span returned here if that is possible.
- the preferred span along the specified axis
getResizeWeight
public int getResizeWeight(int axis)
Returns the resize weight of this view. A value of 0
or less
means this view is not resizeable. Positive values make the view
resizeable. The default implementation returns 0
unconditionally.
- the resizability of this view along the specified axis
insertUpdate
public void insertUpdate(DocumentEvent ev,
Shape shape,
ViewFactory vf)
Receive notification about an insert update to the text model.
The default implementation of this method does the following:
ev
- the DocumentEvent that describes the changeshape
- the shape of the viewvf
- the ViewFactory for creating child views
modelToView
public abstract Shape modelToView(int pos,
Shape a,
Position.Bias b)
throws BadLocationException
Maps a position in the document into the coordinate space of the View.
The output rectangle usually reflects the font height but has a width
of zero.
pos
- the position of the character in the modela
- the area that is occupied by the viewb
- either Position.Bias.Forward
or
Position.Bias.Backward
depending on the preferred
direction bias. If null
this defaults to
Position.Bias.Forward
- a rectangle that gives the location of the document position
inside the view coordinate space
modelToView
public Shape modelToView(int p1,
Position.Bias b1,
int p2,
Position.Bias b2,
Shape a)
throws BadLocationException
Maps a region in the document into the coordinate space of the View.
p1
- the beginning position inside the documentb1
- the direction bias for the beginning positionp2
- the end position inside the documentb2
- the direction bias for the end positiona
- the area that is occupied by the view
- a rectangle that gives the span of the document region
inside the view coordinate space
remove
public void remove(int index)
removeUpdate
public void removeUpdate(DocumentEvent ev,
Shape shape,
ViewFactory vf)
Receive notification about a remove update to the text model.
The default implementation of this method does the following:
ev
- the DocumentEvent that describes the changeshape
- the shape of the viewvf
- the ViewFactory for creating child views
replace
public void replace(int offset,
int length,
View[] views)
Replaces a couple of child views with new child views. If
length == 0
then this is a simple insertion, if
views == null
this only removes some child views.
offset
- the offset at which to replacelength
- the number of child views to be removedviews
- the new views to be inserted, may be null
setParent
public void setParent(View parent)
Sets the parent for this view. This is the first method that is beeing
called on a view to setup the view hierarchy. This is also the last method
beeing called when the view is disconnected from the view hierarchy, in
this case parent
is null.
If parent
is null
, a call to this method also
calls setParent
on the children, thus disconnecting them from
the view hierarchy. That means that super must be called when this method
is overridden.
parent
- the parent to set, null
when this view is
beeing disconnected from the view hierarchy
setSize
public void setSize(float width,
float height)
updateChildren
protected boolean updateChildren(DocumentEvent.ElementChange ec,
DocumentEvent ev,
ViewFactory vf)
Updates the list of children that is returned by
getView(int)
and
getViewCount()
.
Element that are specified as beeing added in the ElementChange record are
assigned a view for using the ViewFactory. Views of Elements that
are specified as beeing removed are removed from the list.
ec
- the ElementChange record that describes the change of the
elementev
- the DocumentEvent describing the change of the document modelvf
- the ViewFactory to use for creating new views
- whether or not the child views represent the child elements of
the element that this view is responsible for. Some views may
create views that are responsible only for parts of the element
that they are responsible for and should then return false.
updateLayout
protected void updateLayout(DocumentEvent.ElementChange ec,
DocumentEvent ev,
Shape shape)
Updates the layout.
ec
- the ElementChange that describes the changes to the elementev
- the DocumentEvent that describes the changes to the modelshape
- the current allocation for this view
viewToModel
public int viewToModel(float x,
float y,
Shape a)
Use viewToModel(float,float,Shape,Position.Bias[])
instead.
Maps coordinates from the View
's space into a position
in the document model. This method is deprecated and only there for
compatibility.
x
- the x coordinate in the view spacey
- the y coordinate in the view spacea
- the allocation of this View
- the position in the document that corresponds to the screen
coordinates
x, y
viewToModel
public abstract int viewToModel(float x,
float y,
Shape a,
Position.Bias[] b)
Maps coordinates from the View
's space into a position
in the document model.
x
- the x coordinate in the view spacey
- the y coordinate in the view spacea
- the allocation of this View
b
- the bias to use
- the position in the document that corresponds to the screen
coordinates
x, y
View.java --
Copyright (C) 2002, 2004, 2005, 2006 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.