javax.swing.text
Class WrappedPlainView
- SwingConstants, TabExpander
BOTTOM , CENTER , EAST , HORIZONTAL , LEADING , LEFT , NEXT , NORTH , NORTH_EAST , NORTH_WEST , PREVIOUS , RIGHT , SOUTH , SOUTH_EAST , SOUTH_WEST , TOP , TRAILING , VERTICAL , WEST |
protected int | calculateBreakPosition(int p0, int p1) - Calculates the break position for the text between model positions
p0 and p1.
|
void | changedUpdate(DocumentEvent e, Shape a, ViewFactory f) - Called when the portion of the Document that this View is responsible
for changes.
|
protected void | drawLine(int p0, int p1, Graphics g, int x, int y) - Draws a line of text, suppressing white space at the end and expanding
tabs.
|
protected int | drawSelectedText(Graphics g, int x, int y, int p0, int p1) - Renders the range of text as selected text.
|
protected int | drawUnselectedText(Graphics g, int x, int y, int p0, int p1) - Renders the range of text as normal unhighlighted text.
|
protected Segment | getLineBuffer() - Provides access to the Segment used for retrievals from the Document.
|
float | getMaximumSpan(int axis) - Determines the maximum span along the given axis.
|
float | getMinimumSpan(int axis) - Determines the minimum span along the given axis.
|
float | getPreferredSpan(int axis) - Determines the preferred span along the given axis.
|
protected int | getTabSize() - Returns the tab size for the Document based on
PlainDocument.tabSizeAttribute, defaulting to 8 if this property is
not defined
|
void | insertUpdate(DocumentEvent e, Shape a, ViewFactory f) - Called when something was inserted.
|
protected void | loadChildren(ViewFactory f) - Loads the children to initiate the view.
|
float | nextTabStop(float x, int tabStop) - Returns the next tab stop position after a given reference position.
|
void | paint(Graphics g, Shape a) - Renders the
Element that is associated with this
View .
|
void | removeUpdate(DocumentEvent e, Shape a, ViewFactory f) - Called when something is removed.
|
void | setSize(float width, float height) - Sets the size of the View.
|
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 |
calculateBreakPosition
protected int calculateBreakPosition(int p0,
int p1)
Calculates the break position for the text between model positions
p0 and p1. Will break on word boundaries or character boundaries
depending on the break argument given in construction of this
WrappedPlainView. Used by the nested WrappedLine class to determine
when to start the next logical line.
p0
- the start model positionp1
- the end model position
- the model position at which to break the text
drawLine
protected void drawLine(int p0,
int p1,
Graphics g,
int x,
int y)
Draws a line of text, suppressing white space at the end and expanding
tabs. Calls drawSelectedText and drawUnselectedText.
p0
- starting document position to usep1
- ending document position to useg
- graphics contextx
- starting x positiony
- starting y position
drawSelectedText
protected int drawSelectedText(Graphics g,
int x,
int y,
int p0,
int p1)
throws BadLocationException
Renders the range of text as selected text. Just paints the text
in the color specified by the host component. Assumes the highlighter
will render the selected background.
g
- the graphics contextx
- the starting X coordinatey
- the starting Y coordinatep0
- the starting model locationp1
- the ending model location
- the X coordinate of the end of the text
drawUnselectedText
protected int drawUnselectedText(Graphics g,
int x,
int y,
int p0,
int p1)
throws BadLocationException
Renders the range of text as normal unhighlighted text.
g
- the graphics contextx
- the starting X coordinatey
- the starting Y coordinatep0
- the starting model locationp1
- the end model location
- the X location of the end off the range
getLineBuffer
protected final Segment getLineBuffer()
Provides access to the Segment used for retrievals from the Document.
getMaximumSpan
public float getMaximumSpan(int axis)
Determines the maximum span along the given axis. Implemented to
cache the font metrics and then call the super classes method.
- getMaximumSpan in interface BoxView
getMinimumSpan
public float getMinimumSpan(int axis)
Determines the minimum span along the given axis. Implemented to
cache the font metrics and then call the super classes method.
- getMinimumSpan in interface BoxView
getPreferredSpan
public float getPreferredSpan(int axis)
Determines the preferred span along the given axis. Implemented to
cache the font metrics and then call the super classes method.
- getPreferredSpan in interface BoxView
getTabSize
protected int getTabSize()
Returns the tab size for the Document based on
PlainDocument.tabSizeAttribute, defaulting to 8 if this property is
not defined
nextTabStop
public float nextTabStop(float x,
int tabStop)
Returns the next tab stop position after a given reference position.
This implementation ignores the tabStop
argument.
- nextTabStop in interface TabExpander
x
- the current x position in pixelstabStop
- the position within the text stream that the tab occured at
paint
public void paint(Graphics g,
Shape a)
Renders the Element
that is associated with this
View
. Caches the metrics and then calls
super.paint to paint all the child views.
- paint in interface BoxView
g
- the Graphics
context to render toa
- the allocated region for the Element
setSize
public void setSize(float width,
float height)
Sets the size of the View. Implemented to update the metrics
and then call super method.
- setSize in interface BoxView
WrappedPlainView.java --
Copyright (C) 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.